Skip to content

Update to Testcontainers 2.0.2#51314

Merged
gsmet merged 5 commits intoquarkusio:mainfrom
gsmet:testcontainers-2.0.2
Dec 3, 2025
Merged

Update to Testcontainers 2.0.2#51314
gsmet merged 5 commits intoquarkusio:mainfrom
gsmet:testcontainers-2.0.2

Conversation

@gsmet
Copy link
Member

@gsmet gsmet commented Dec 1, 2025

@gastaldi this includes all your work + a commit to work around the Strimzi issue. I got surprised that Debezium had it working and I gave it a try.

Note that there are probably things that wouldn't work but from my testing our use cases seems to somehow work. I did test only one Kafka module that uses the Strimzi container though.

Let's see how it goes.

@quarkus-bot
Copy link

quarkus-bot bot commented Dec 1, 2025

/cc @loicmathieu (elasticsearch), @marko-bekhta (elasticsearch)

<testcontainers.version>2.0.2</testcontainers.version> <!-- Make sure to also update docker-java.version to match its needs -->
<docker-java.version>3.4.2</docker-java.version> <!-- must be the version Testcontainers use: https://central.sonatype.com/artifact/org.testcontainers/testcontainers -->
<!-- Check the compatibility matrix (https://github.com/opensearch-project/opensearch-testcontainers) before upgrading: -->
<opensearch-testcontainers.version>2.0.2</opensearch-testcontainers.version>
Copy link
Member

Choose a reason for hiding this comment

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

And this:

Suggested change
<opensearch-testcontainers.version>2.0.2</opensearch-testcontainers.version>
<opensearch-testcontainers.version>4.0.0</opensearch-testcontainers.version>

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately, this version is Java 21+ so not sure what to do about it...

Copy link
Member

Choose a reason for hiding this comment

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

I wonder... how much do we actually need it ... since we already have some config of the container here:

private CreatedContainer createOpensearchContainer(ElasticsearchDevServicesBuildTimeConfig config,
DockerImageName resolvedImageName, String defaultNetworkId, boolean useSharedNetwork) {
OpensearchContainer container = new OpensearchContainer(
resolvedImageName.asCompatibleSubstituteFor("opensearchproject/opensearch"));
String hostName = ConfigureUtil.configureNetwork(container, defaultNetworkId, useSharedNetwork, DEV_SERVICE_OPENSEARCH);
container.addEnv("bootstrap.memory_lock", "true");
container.addEnv("plugins.index_state_management.enabled", "false");
// Disable disk-based shard allocation thresholds: on large, relatively full disks (>90% used),
// it will lead to index creation to get stuck waiting for other nodes to join the cluster,
// which will never happen since we only have one node.
// See https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-settings/
container.addEnv("cluster.routing.allocation.disk.threshold_enabled", "false");
container.addEnv("OPENSEARCH_JAVA_OPTS", config.javaOpts());
// OpenSearch 2.12 and later requires an admin password, or it won't start.
// Considering dev services are transient and not intended for production by nature,
// we'll just set some hardcoded password.
container.addEnv("OPENSEARCH_INITIAL_ADMIN_PASSWORD", "NotActua11y$trongPa$$word");
return new CreatedContainer(container, hostName);
}

we might be able to just add another env variable to disalbe the security plugin ...
(just in case ... in Hibernate Search we just use a generic container and have specific settings for different versions of OpenSearch (https://github.com/hibernate/hibernate-search/blob/fcffca0a0a8bcaabe2ea74918925ce52ea463a5b/util/internal/integrationtest/backend/elasticsearch/src/main/java/org/hibernate/search/util/impl/integrationtest/backend/elasticsearch/SearchBackendContainer.java#L142-L172)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I'm experimenting with it as we speak to see what we can do.

Copy link
Member Author

Choose a reason for hiding this comment

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

I kept the library and updated it a bit. I agree it doesn't have that much value but I didn't drop it.

What I did change is that our testing is now using the Testcontainers infrastructure as I needed that to check things were working and it's something @holly-cummins was working on anyway.

@gsmet gsmet force-pushed the testcontainers-2.0.2 branch from d42e774 to b022147 Compare December 1, 2025 12:44
@quarkus-bot

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

🎊 PR Preview 5fe1704 has been successfully built and deployed to https://quarkus-pr-main-51314-preview.surge.sh/version/main/guides/

  • Images of blog posts older than 3 months are not available.
  • Newsletters older than 3 months are not available.

@quarkus-bot quarkus-bot bot added the area/hibernate-search Hibernate Search label Dec 1, 2025
@quarkus-bot

This comment has been minimized.

@gsmet gsmet marked this pull request as draft December 1, 2025 17:07
@gsmet
Copy link
Member Author

gsmet commented Dec 1, 2025

OK, while Strimzi was not an issue, there are other issues related to kindcontainer so we will have to wait for a release there.

See:

@holly-cummins
Copy link
Contributor

I had an ickiness I needed to add in the JPA Postgres tests until we had Testcontainers 2, so I've pushed a commit which removes it, while I still remember it.

dependabot bot and others added 5 commits December 2, 2025 10:01
Updates `org.testcontainers:testcontainers-bom` from 1.21.3 to 2.0.2
- [Release notes](https://github.com/testcontainers/testcontainers-java/releases)
- [Changelog](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md)
- [Commits](testcontainers/testcontainers-java@1.21.3...2.0.2)

Updates `org.testcontainers:testcontainers` from 1.21.3 to 2.0.2
- [Release notes](https://github.com/testcontainers/testcontainers-java/releases)
- [Changelog](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md)
- [Commits](testcontainers/testcontainers-java@1.21.3...2.0.2)

---
updated-dependencies:
- dependency-name: org.testcontainers:testcontainers-bom
  dependency-version: 2.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: org.testcontainers:testcontainers
  dependency-version: 2.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Co-authored-by: George Gastaldi <gegastaldi@gmail.com>
Co-authored-by: Guillaume Smet <guillaume.smet@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
There are efforts going on here:
dajudge/kindcontainer#402
strimzi/test-container#166

But for now, it seems good enough to add a few exclusions.
For now, we can't update to 4.x as it only supports Java 21+.

I created
opensearch-project/opensearch-testcontainers#313
to see if they could support Java 17 again.
This way, we can check they are still working correctly.
@gsmet gsmet force-pushed the testcontainers-2.0.2 branch from b90e64f to 24d7ac9 Compare December 2, 2025 09:02
@gsmet gsmet marked this pull request as ready for review December 2, 2025 09:28
@gsmet
Copy link
Member Author

gsmet commented Dec 2, 2025

This should be ready now.

@quarkus-bot
Copy link

quarkus-bot bot commented Dec 2, 2025

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit 24d7ac9.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

Warning

There are other workflow runs running, you probably need to wait for their status before merging.

@quarkus-bot
Copy link

quarkus-bot bot commented Dec 2, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 24d7ac9.

Failing Jobs

Status Name Step Failures Logs Raw logs Build scan
JVM Tests - JDK 17 Build Failures Logs Raw logs 🔍
JVM Tests - JDK 21 Build Failures Logs Raw logs 🚧
✔️ JVM Tests - JDK 21 Semeru Logs Raw logs 🚧
✔️ JVM Tests - JDK 25 Logs Raw logs 🚧
Quickstarts Compilation - JDK 17 Compile Quickstarts ⚠️ Check → Logs Raw logs 🚧

You can consult the Develocity build scans.

Failures

⚙️ JVM Tests - JDK 17 #

- Failing: extensions/smallrye-openapi/deployment 
! Skipped: devtools/bom-descriptor-json extensions/agroal/deployment extensions/elytron-security-jdbc/deployment and 57 more

📦 extensions/smallrye-openapi/deployment

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.4:test (default-test) on project quarkus-smallrye-openapi-deployment:

See /home/runner/_work/quarkus/quarkus/extensions/smallrye-openapi/deployment/target/surefire-reports for the individual test results.
See dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
There was an error in the forked process


⚙️ JVM Tests - JDK 21 #

- Failing: extensions/smallrye-openapi/deployment 
! Skipped: devtools/bom-descriptor-json extensions/agroal/deployment extensions/elytron-security-jdbc/deployment and 57 more

📦 extensions/smallrye-openapi/deployment

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.4:test (default-test) on project quarkus-smallrye-openapi-deployment:

See /home/runner/_work/quarkus/quarkus/extensions/smallrye-openapi/deployment/target/surefire-reports for the individual test results.
See dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
There was an error in the forked process


Flaky tests - Develocity

⚙️ MicroProfile TCKs Tests

📦 tcks/microprofile-lra

org.eclipse.microprofile.lra.tck.TckRecoveryTests.testCancelWhenParticipantIsUnavailable - History

  • Expecting the metric Compensated callback was called Expected: a value equal to or greater than <1> but: <0> was less than <1> - java.lang.AssertionError
Details
java.lang.AssertionError: 
Expecting the metric Compensated callback was called
Expected: a value equal to or greater than <1>
     but: <0> was less than <1>
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.eclipse.microprofile.lra.tck.TckRecoveryTests.assertMetricCallbackCalled(TckRecoveryTests.java:210)
	at org.eclipse.microprofile.lra.tck.TckRecoveryTests.testCancelWhenParticipantIsUnavailable(TckRecoveryTests.java:195)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

@gsmet gsmet merged commit 1f8a7cc into quarkusio:main Dec 3, 2025
80 of 83 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.31 - main milestone Dec 3, 2025
@rsvoboda
Copy link
Member

rsvoboda commented Dec 4, 2025

I think this should have breaking change label and a note in https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.31

Motivation: Testcontainers 2 introduce change in GAVs and some packages

@geoand
Copy link
Contributor

geoand commented Dec 5, 2025

I think this should have breaking change label

It's definitely a breaking change, Quarkus LangChain4j for example fails on with this change. Adding the label as a result

@albers
Copy link
Contributor

albers commented Dec 9, 2025

This also broke Quarkiverse CI for the Quarkus Azure Services: quarkiverse/quarkiverse#85

The extension is built against Quarkus 3.30.2 (which manages org.testcontainers:azure:1.21.3) but Quarkiverse CI tests against the current Quarkus snapshot (which manages org.testcontainers:testcontainers-azure:2.0.2).

/cc @majguo

@gsmet
Copy link
Member Author

gsmet commented Dec 9, 2025

@majguo from my experience, the issues are mostly renaming artifacts but let me know if you encounter an issue. Quarkus 3.31 is planned for end of January. The Core artifacts to which you will be able to upgrade before the release will be published on January 21st.

@albers
Copy link
Contributor

albers commented Dec 9, 2025

@gsmet It is only a matter of the 1.x dependency no longer being managed.
Fixing the dependency and nailing the version to 2.0.2 in the extension should do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants