Skip to content

Modernize and clean up the integration tests#6

Open
jacomago wants to merge 14 commits intomasterfrom
claude/modernize-spring-boot-tests-Wu14R
Open

Modernize and clean up the integration tests#6
jacomago wants to merge 14 commits intomasterfrom
claude/modernize-spring-boot-tests-Wu14R

Conversation

@jacomago
Copy link
Copy Markdown
Owner

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)

claude and others added 14 commits February 20, 2026 12:18
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
@jacomago jacomago force-pushed the claude/modernize-spring-boot-tests-Wu14R branch from 8de208e to c40ca17 Compare February 20, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants