Open
Conversation
Introduce AbstractElasticsearchIT, a shared base for all integration tests. It starts a single Elasticsearch 8.18.0 container via Testcontainers, injects the URL with @DynamicPropertySource, and exposes a TestRestTemplate for HTTP-level assertions. Replace the external-Elasticsearch + manual skipITs/jacoco flags approach: - Remove skipITs and jacoco.skip defaults so mvn verify runs everything - Bind failsafe integration-test and verify goals to the lifecycle so integration tests run as part of the standard verify phase - Remove org.jacoco.agent runtime dep and maven-dependency-plugin copy execution (were only needed for the Docker Compose JaCoCo agent) - Remove integrationtest-docker Maven profile (Docker tests deleted) - Add testcontainers-elasticsearch test dependency https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
Replace @WebMvcTest + manual ElasticConfigIT.setUp/teardown lifecycle with extends AbstractElasticsearchIT in: - TagRepositoryIT - PropertyRepositoryIT - ChannelRepositoryIT https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
Replace @WebMvcTest + manual ElasticConfigIT lifecycle with extends AbstractElasticsearchIT in: - TagControllerIT - PropertyControllerIT - ChannelControllerIT https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
Replace @WebMvcTest + manual ElasticConfigIT lifecycle with extends AbstractElasticsearchIT in: - TagValidationIT - PropertyValidationIT - ChannelValidationIT https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
Remove @SpringBootTest(MOCK) + @ContextConfiguration + @Autowired ElasticConfig lifecycle; extend AbstractElasticsearchIT instead. Keep @AutoConfigureMockMvc and @activeprofiles("metrics"). https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
New test class extending AbstractElasticsearchIT that covers the HTTP
surface previously tested only by Docker-based ITs:
- GET /resources/{tags,properties,channels,scroll} returns 200
- PUT with malformed JSON body returns 400
- Unauthenticated PUT returns 401
https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
Replace PopulateDBConfiguration.createDB/cleanupDB with a private helper that builds channels, tags, and properties directly via repository APIs. Extends AbstractElasticsearchIT. https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
Replace PopulateDBConfiguration usage with inline channel creation via repository APIs in ChannelScrollControllerIT and ChannelScrollControllerSearchIT. Both extend AbstractElasticsearchIT. https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
ExistsPerformanceIT and PopulateDBConfigurationIT relied on PopulateDBConfiguration.createDB(), which no longer exists. Remove the tests and their dedicated resource files. https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
PopulateDBConfiguration was a 1400-line demo-data generator wired into the production application via ApplicationRunner. No production path needs it; test data is now created inline in each IT. Remove the class and the --demo-data/--cleanup CLI handling from Application.java. https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
Remove the docker/ package (11 files: 5 test classes + 6 utility classes) that drove a full Docker Compose stack (build JAR, build image, start Elasticsearch, start app). Their coverage is superseded by the Testcontainers-based ITs. Also remove the Dockerfile, compose.yml, and tutorial docs that supported this workflow. https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
ElasticConfigIT was the manual Elasticsearch lifecycle helper used by all old @WebMvcTest ITs; no longer needed. The three JUnit 4 stubs (ExternalResource, TestRule, Statement) were workarounds for a Testcontainers transitive dependency on ComposeContainer; also no longer needed. https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
Testcontainers now manages the Elasticsearch lifecycle internally, so remove the external elastic-github-actions step and the Docker image prune step. Replace the hand-crafted failsafe invocation with a plain mvn verify, which is sufficient now that the failsafe plugin is bound to the lifecycle and skipITs/jacoco.skip defaults are removed. https://claude.ai/code/session_013no8HgB52Rbg3i7fnN5tLJ
8de208e to
c40ca17
Compare
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.
Goals:
Simplify
Avoid need to have ElasticSearch running while running tests
Remove PopulateConfigurationDB (Can replace with an example script in the docs to create demo db from a client if someone wishes, or even better a docker compose that has IOCs and recceiver running)
Claude actually suggested the removal of the docker tests since they overlap so much with the others... (which I agreed with already, I think the test coverage went from 73 to 77 when the coverage ci was working)