feat: Add TestContainers integration tests for MySQL and PostgreSQL#42
Merged
dfcoffin merged 2 commits intoDec 20, 2025
Merged
Conversation
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>
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
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
BaseTestContainersTestbase class with reusable MySQL and PostgreSQL containersComplexRelationshipMySQLIntegrationTestwith 6 integration testsComplexRelationshipPostgreSQLIntegrationTestwith 6 integration testsapplication-test-mysql.yml,application-test-postgresql.yml)uuid,uuid_msb, anduuid_lsbcolumns from all Flyway migration scriptsV4__Drop_ApplicationInformation_Extension_Columns.sql(no longer needed)idcolumn insteadTest Coverage
Test Results
Test plan
mvn test -Dtest=UsagePointRepositoryTest,AuthorizationRepositoryTest,BatchListRepositoryTestmvn failsafe:integration-test -Dit.test=ComplexRelationshipMySQLIntegrationTestmvn failsafe:integration-test -Dit.test=ComplexRelationshipPostgreSQLIntegrationTestmvn verify🤖 Generated with Claude Code