Skip to content

Migrate removed LocalStack Service enum and getEndpointOverride in Testcontainers 2.x migration#1014

Merged
MBoegers merged 1 commit into
mainfrom
MBoegers/unresolved-references
Jun 12, 2026
Merged

Migrate removed LocalStack Service enum and getEndpointOverride in Testcontainers 2.x migration#1014
MBoegers merged 1 commit into
mainfrom
MBoegers/unresolved-references

Conversation

@MBoegers

@MBoegers MBoegers commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Why

Testcontainers2Migration renames org.testcontainers.containers.localstack.LocalStackContainerorg.testcontainers.localstack.LocalStackContainer, but Testcontainers 2.x removed the nested Service enum and the getEndpointOverride(...) method from the new class. So after the type rename, LocalStackContainer.Service.SQS and getEndpointOverride(...) become unresolved references, breaking compilation in both Java and Kotlin.

What

Adds a Testcontainers2LocalStack step to Testcontainers2Migration, run before the type rename (so it matches the old type). Fully declarative, composed from core recipes:

  • ReplaceConstant (one per Service constant) — replaces LocalStackContainer.Service.X with its LocalStack service-name string (e.g. "sqs"), including the non-trivial names API_GATEWAYapigateway, DYNAMODB_STREAMSdynamodbstreams, CLOUDWATCHLOGSlogs. This makes withServices(...) compile against the 2.x withServices(String...) API.
  • ChangeMethodName + DeleteMethodArgumentgetEndpointOverride(service)getEndpoint().

Covered by Java + Kotlin tests, including an end-to-end reproduction through the full Testcontainers2Migration.

Part of moderneinc/customer-requests#2437 (the unresolved-references half; the separate ktlint-comment-removal issue is not addressed here).

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Jun 8, 2026
@MBoegers MBoegers marked this pull request as draft June 8, 2026 13:54
@MBoegers MBoegers force-pushed the MBoegers/unresolved-references branch from 794f80a to c9e334a Compare June 8, 2026 14:01
@MBoegers MBoegers marked this pull request as ready for review June 8, 2026 14:18

@steve-aom-elliott steve-aom-elliott left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, probably just bump the year up in the copyright is all

@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite Jun 8, 2026
…n Testcontainers 2.x

Testcontainers 2.x removed the nested `LocalStackContainer.Service` enum and `getEndpointOverride(...)`. The existing `Testcontainers2Migration` only renamed the type, leaving `LocalStackContainer.Service.SQS` and `getEndpointOverride(...)` as unresolved references (Java and Kotlin alike).

Add a `Testcontainers2LocalStack` step (run before the type rename) that replaces `Service` constants with their service-name strings and `getEndpointOverride(service)` with `getEndpoint()`.
@MBoegers MBoegers force-pushed the MBoegers/unresolved-references branch from c9e334a to d0e59da Compare June 12, 2026 09:19
@MBoegers MBoegers merged commit e1cb892 into main Jun 12, 2026
1 check passed
@MBoegers MBoegers deleted the MBoegers/unresolved-references branch June 12, 2026 09:28
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants