Skip to content

refactor: replace @DirtiesContext with shared containers and @Transactional rollback#55

Merged
Washingtonwei merged 2 commits into
mainfrom
refactor/integration-test-performance-improvement
May 25, 2026
Merged

refactor: replace @DirtiesContext with shared containers and @Transactional rollback#55
Washingtonwei merged 2 commits into
mainfrom
refactor/integration-test-performance-improvement

Conversation

@Washingtonwei

Copy link
Copy Markdown
Owner

Summary

  • Introduce SharedContainers — singleton MySQL + Mailpit containers started once per JVM, shared across all integration test classes
  • Introduce AbstractIntegrationTest — base class with @Transactional (auto-rollback after each test), replacing 60 @DirtiesContext annotations across 14 files
  • Migrate all 17 integration test classes to extend the base class, removing per-class container declarations and redundant annotations

Impact

Metric Before After
MySQL containers started ~17 1
Spring contexts created ~77 2
@DirtiesContext reloads 60 0
Test suite runtime ~25-30 min ~5 min

Test plan

  • Full test suite passes: 294 tests, 0 failures, 0 errors
  • Verified runtime: 5:11 min

Closes #54

🤖 Generated with Claude Code

Washingtonwei and others added 2 commits May 25, 2026 07:34
…ainers

Introduce SharedContainers (singleton MySQL + Mailpit per JVM) and
AbstractIntegrationTest base class with @transactional rollback.
All 17 integration test classes now extend the base class, eliminating
60 @DirtiesContext annotations and ~15 redundant container instances.

Test suite runtime drops from ~25-30 min to ~5 min.

Closes #54

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Washingtonwei
Washingtonwei merged commit d3337b0 into main May 25, 2026
2 checks passed
@Washingtonwei
Washingtonwei deleted the refactor/integration-test-performance-improvement branch May 25, 2026 12:50
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.

Optimize integration test suite: replace @DirtiesContext with @Transactional and shared containers

1 participant