Skip to content

Conversation

@dfcoffin
Copy link
Contributor

@dfcoffin dfcoffin commented Dec 19, 2025

Summary

Add comprehensive TestContainers-based integration tests to verify database compatibility with MySQL 8.0 and PostgreSQL 15. These tests use Docker to spin up real database instances, ensuring the Flyway migrations and JPA entity mappings work correctly across different database vendors.

Changes

  • Add BaseTestContainersTest base class with reusable MySQL and PostgreSQL containers
  • Add ComplexRelationshipMySQLIntegrationTest with 6 integration tests
  • Add ComplexRelationshipPostgreSQLIntegrationTest with 6 integration tests
  • Create profile-based test configurations (application-test-mysql.yml, application-test-postgresql.yml)
  • Remove legacy uuid, uuid_msb, and uuid_lsb columns from all Flyway migration scripts
  • Remove ApplicationInformation extension columns that don't match ESPI 4.0 XSD
  • Delete V4__Drop_ApplicationInformation_Extension_Columns.sql (no longer needed)
  • Fix uuid index references to use id column instead

Test Coverage

  • ✅ Customer → Statement relationships
  • ✅ UsagePoint → MeterReading → IntervalBlock hierarchy
  • ✅ RetailCustomer → UsagePoint relationships
  • ✅ Transaction boundary consistency
  • ✅ Bulk save and delete operations

Test Results

  • H2: 58 repository tests passing
  • MySQL 8.0: 6/6 integration tests passing
  • PostgreSQL 15: 6/6 integration tests passing

Test plan

  • Run H2 repository tests: mvn test -Dtest=UsagePointRepositoryTest,AuthorizationRepositoryTest,BatchListRepositoryTest
  • Run MySQL integration tests: mvn failsafe:integration-test -Dit.test=ComplexRelationshipMySQLIntegrationTest
  • Run PostgreSQL integration tests: mvn failsafe:integration-test -Dit.test=ComplexRelationshipPostgreSQLIntegrationTest
  • Run full test suite: mvn verify
  • Verify CI/CD pipeline passes

🤖 Generated with Claude Code

dfcoffin and others added 2 commits December 19, 2025 18:07
Add comprehensive TestContainers-based integration tests to verify database
compatibility with MySQL 8.0 and PostgreSQL 15. These tests use Docker to
spin up real database instances, ensuring the Flyway migrations and JPA
entity mappings work correctly across different database vendors.

Changes:
- Add BaseTestContainersTest base class with reusable MySQL and PostgreSQL containers
- Add ComplexRelationshipMySQLIntegrationTest with 6 integration tests
- Add ComplexRelationshipPostgreSQLIntegrationTest with 6 integration tests
- Create profile-based test configurations (application-test-mysql.yml, application-test-postgresql.yml)
- Remove legacy uuid, uuid_msb, and uuid_lsb columns from all Flyway migration scripts
- Remove ApplicationInformation extension columns that don't match ESPI 4.0 XSD
- Delete V4__Drop_ApplicationInformation_Extension_Columns.sql (no longer needed)
- Fix uuid index references to use id column instead

Test Coverage:
- Customer → Statement relationships
- UsagePoint → MeterReading → IntervalBlock hierarchy
- RetailCustomer → UsagePoint relationships
- Transaction boundary consistency
- Bulk save and delete operations

All tests passing:
- H2: 58 repository tests passing
- MySQL 8.0: 6/6 integration tests passing
- PostgreSQL 15: 6/6 integration tests passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Database Driver Version Alignment:
- Downgraded MySQL Connector/J from 9.1.0 to 8.4.0 to match MySQL 8.0
  server version used in TestContainers integration tests
- Ensures compatibility: MySQL server (mysql:8.0) + MySQL Connector/J 8.4.0
- PostgreSQL versions confirmed compatible: postgres:15-alpine + JDBC 42.7.7

Dependency Cleanup:
- Removed duplicate TestContainers dependency declarations for junit-jupiter,
  mysql, and postgresql modules
- Dependencies now managed only by TestContainers BOM 1.20.1
- Eliminates Maven warnings about duplicate dependency declarations

Failsafe Plugin Configuration:
- Configured maven-failsafe-plugin to recognize *IntegrationTest.java pattern
- Integration tests now run automatically during 'mvn verify' phase
- Supports both **/*IntegrationTest.java and **/*IT.java patterns

Verification:
- All 18 integration tests passing (6 H2, 6 PostgreSQL, 6 MySQL)
- Tests verified with MySQL Connector/J 8.4.0
- Failsafe automatically executes integration tests in verify phase

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@dfcoffin dfcoffin merged commit d5e321b into main Dec 20, 2025
5 checks passed
@dfcoffin dfcoffin deleted the feature/testcontainers-mysql-postgresql-integration branch December 20, 2025 05:40
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