Use Testcontainers for integration tests#2033
Open
lsh1215 wants to merge 4 commits into
Open
Conversation
b151d92 to
389d48e
Compare
Signed-off-by: sanghun <vitash1215@gmail.com>
389d48e to
5923c09
Compare
Signed-off-by: sanghun <vitash1215@gmail.com>
Signed-off-by: sanghun <vitash1215@gmail.com>
reta
requested changes
Jun 30, 2026
| testImplementation("org.opensearch.test", "framework", opensearchVersion) { | ||
| exclude(group = "org.hamcrest") | ||
| } | ||
| "java21Implementation"("org.testcontainers:testcontainers:2.0.5") |
Collaborator
There was a problem hiding this comment.
Please let's use official https://github.com/opensearch-project/opensearch-testcontainers
Contributor
Author
There was a problem hiding this comment.
Sorry, I missed the official module in the first pass. Thanks for pointing it out.
Updated in 728e3fe.
The integration test container setup now uses org.opensearch.testcontainers.OpenSearchContainer, and the local GenericContainer setup code has been removed.
The remaining Testcontainers dependency is compileOnly only, since OpenSearchContainer extends GenericContainer and javac needs that superclass API.
The current CI failures appear unrelated to the test changes; the failed jobs stopped during Gradle buildSrc dependency resolution.
Signed-off-by: sanghun <vitash1215@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds Testcontainers-backed OpenSearch startup for Java client integration tests so developers and the released integration workflow no longer need to start OpenSearch with Docker Compose before running
integrationTest.The Testcontainers path is enabled by default for the
integrationTesttask. Existing externally managed clusters remain supported by settingtests.rest.clusteror disabling the test container with-Dtests.opensearch.testcontainers.enabled=false.The Docker/Testcontainers startup path is limited to the
integrationTesttask. The released integration CI path remains Ubuntu-only, and the macOS/Windows build and unit-test jobs do not get a Docker runtime requirement.Closes #1916.
Changes
OpenSearchTestContainerhelper for integration tests.OpenSearchRestTestCaseinitializes its REST client.cluster.blocks.create_index=trueduring tests.Verification
git diff --check./gradlew integrationTest --tests "org.opensearch.client.opensearch.integTest.OpenSearchTestContainerTests"./gradlew spotlessJavaCheck./gradlew integrationTest --tests "org.opensearch.client.opensearch.integTest.restclient.PingAndInfoIT" -Dtests.opensearch.version=3.2.0