build(test): pin Testcontainers images in the version catalog - #199
Open
adityamparikh wants to merge 4 commits into
Open
adityamparikh wants to merge 4 commits into
adityamparikh wants to merge 4 commits into
Conversation
The class had been @disabled since #41 because starting the Grafana LGTM Testcontainer threw a ClassNotFoundException for org.eclipse.jetty.client.transport.HttpClientTransportOverHTTP. The Jetty pin has since moved with the SolrJ 10 bump, jetty-client 12.0.34 is on the test runtime classpath and contains that class, and the container now starts cleanly. With the annotation removed, three methods failed with AuthenticationCredentialsNotFoundException: the test calls @PreAuthorize service methods directly, with no MCP request and hence no principal. Rather than switch http.security.enabled off, the test authenticates its own thread with a TestingAuthenticationToken in @beforeeach and clears it in @AfterEach, so method security stays active while OTLP export is verified. All seven methods pass; the build no longer reports any skipped tests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019zJ9WA8nNyA5Yxb8ueM7vV Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Pin the Solr and Grafana LGTM images the tests start to exact tags, solr:9.9.0-slim and grafana/otel-lgtm:0.33.0, declared once as test-image-solr / test-image-lgtm in gradle/libs.versions.toml. Previously the Solr default was spelled out three times and the LGTM image floated on latest: the locally cached "latest" was 0.28.0 from May while Docker Hub's had moved to 0.33.0, so the same test run meant different things on different machines. processTestResources expands the pins into test-images.properties and the Gradle test tasks also forward them as system properties. A new TestImages resolver prefers a non-blank -Dsolr.test.image / -Dlgtm.test.image, so the Solr compatibility matrix keeps working, and falls back to the resource otherwise; the resource is included in the native test binary explicitly. TestImagesTest fails the build if a pin is missing, floats on latest, or is not an exact release tag. Verified: ./gradlew build 407 tests, 0 failures, 0 skipped; ./gradlew nativeTest -Pnative 405 tests, 0 failures, 138 skipped (Mockito). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019zJ9WA8nNyA5Yxb8ueM7vV Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
TestImagesTest cleared the real solr.test.image / lgtm.test.image system properties, and Gradle runs every test class in one fork, so any container started after it fell back to the catalog pin. The Solr compatibility matrix in CI passes -Dsolr.test.image and could end up testing the pinned version while reporting another. The pin-guard tests now read the expanded resource through TestImages.pinned(key) and never touch system properties; the two override tests that covered three lines of resolve() are dropped. Also hoists the catalog pins to one declaration in build.gradle.kts, removes the duplicate systemProperty forwarding on integrationTest (withType<Test> already covers it), and stops the docs from demonstrating the moving solr:9.9-slim tag as an override example. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
…ticated The class javadoc still said the test was disabled for a Jetty ClassNotFoundException; that paragraph now describes the LGTM container and the self-authenticated test thread. TestingAuthenticationToken's authorities constructor already marks the token authenticated, so the explicit call goes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ Signed-off-by: Aditya Parikh <aditya.m.parikh@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.
Summary
Pins the Docker images the Testcontainers-based tests start to exact tags, declared once in
gradle/libs.versions.toml:Why
solr:9.9-slimwas spelled out three times (twice inbuild.gradle.kts, once inTestcontainersConfiguration) and is a moving minor tag.latest; a cachedlateston one machine was 0.28.0 while Docker Hub's was 0.33.0, so the same green run meant different images.How the pins reach the tests
processTestResourcesexpands them intosrc/test/resources/test-images.properties;tasks.withType<Test>also forwards them as thesolr.test.image/lgtm.test.imagesystem properties.TestImagesprefers a non-blank system property, so./gradlew test -Dsolr.test.image=solr:9.4-slimand the CI compatibility matrix keep working, and falls back to the expanded resource otherwise (which keeps@Container staticinitialisers working where properties are not forwarded, e.g.processTestAot).-H:IncludeResources.TestImagesTestfails the build if either pin is missing, floats onlatest, or is not an exact release tag. It reads the expanded resource throughTestImages.pinnedand never touches system properties, so it cannot interfere with a-Doverride in the same test JVM.AGENTS.mdanddev-docs/DEVELOPMENT.mdpoint at the catalog instead of quoting a tag.Bumping an image
Edit the two catalog entries. Dependabot's
gradleecosystem cannot resolve Docker tags in the catalog, so these stay manual.Verification
./gradlew buildon Java 25: 405 tests, 0 failures, 0 skipped.OtlpExportIntegrationTest7/7 againstgrafana/otel-lgtm:0.33.0.🤖 Generated with Claude Code
https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ