Repository navigation
test(testkit): one Elasticsearch container per test JVM, reset before each suite - #463
Merged
Merged
Conversation
… each suite (CI-1) Story CI-1. Reviewed: r0:must-fix, r1:clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fupelaqu
marked this pull request as ready for review
November 13, 2026 17:29
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.
Summary
Integration suites now share one Elasticsearch container per forked test JVM, instead of starting one each. Before each suite, the container is reset to the state it had right after it started. In PR #462's CI run, the Elasticsearch phase started 222 containers, and booting them took 54.5 min. With this change the same phase should start 16.
Sharing is switched on by a system property,
softclient4es.testkit.shared-container=true. Only theTest / javaOptionsof elasticsql's five Elasticsearch modules set it. Without the property the testkit behaves as before, so a downstream repository that does not set the property sees no change.What changes
SharedElasticContainers: a registry that holds one container per JVM for each configuration key. The key is the image tag plus theelasticsearch.ymltext, rendered by the existing renderer.activeand takes a snapshot of the cluster.ClusterResetruns instart(), before each suite..;ElasticClientFactory.shutdown())..or contains@, one marked_meta.managed, one already in the snapshot, or a reserved user.ElasticDockerTestKit:start()andstop()check whetherelasticContaineris a shared container, by identity. The property only chooses the defaultelasticContainer. A suite that overrideselasticContainer(for example a basic-licence container) keeps its own container and today's lifecycle, with or without the property.ElasticContainerSharing: an opt-out member,sharedContainer.GatewayApiIntegrationSpecandReplGatewayIntegrationSpecset it to false, because they assert on the whole cluster. They keep a container each.SharedContainerResetSpec(one runner per client module) andJavaClientSharedSecureResetSpec(es8, secure container). They plant every kind of object, then check that the reset deletes them and keeps the system ones. They also check that a refused kind fails the next reset with the right suite name.[es-container]line per container started;[es-reset]line per reset, with its duration and what it deleted;[es-leaks]line after each suite: open scroll and search contexts, and script compilations.-oDadds each test's duration in the five Elasticsearch modules.build.ymlandrelease.yml):lscpu,nproc,free -m,docker info);test-reportsartifact, even when tests fail.Verification
Elasticsearch 8.18.3,
es8java/test,mainagainst this branch:mainmain: in all three branch runs, every suite ofmaingives the same counts (succeeded, failed, canceled, ignored, pending, aborted) as onmain. The counts come from the test log, because the JUnit XML records a canceled test as a pass.ClusterResetPlanSpec: 19/0;ElasticDockerTestKitLifecycleSpec: 5/0 (no Docker);sbt "+ compile"(2.12.20 and 2.13.16);headerCheck scalafmtSbtCheck scalafmtCheck test:scalafmtCheck.CI run of this PR
Compared with #462's run, using its complete job log:
main+ #462)sbt + compilesbt compile testtest-reportsartifact is uploaded (1.3 MB).Release note
softclient4es{6,7,8,9}-core-testkitchanges.ElasticDockerTestKitgains members, andGatewayApiIntegrationSpecandReplGatewayIntegrationSpecnow mix inElasticContainerSharing. Test classes that extend them must be rebuilt.Recorded, not fixed
🤖 Generated with Claude Code