Commit d5e321b
feat: Add TestContainers integration tests for MySQL and PostgreSQL (#42)
* feat: add TestContainers integration tests for MySQL and PostgreSQL
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 <[email protected]>
* fix: align MySQL Connector with TestContainers & configure Failsafe
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 <[email protected]>
---------
Co-authored-by: Claude Sonnet 4.5 <[email protected]>1 parent 444b713 commit d5e321b
File tree
12 files changed
+718
-265
lines changed- openespi-common
- src
- main/resources/db
- migration
- vendor
- h2
- mysql
- postgres
- test
- java/org/greenbuttonalliance/espi/common
- repositories/integration
- test
- resources
12 files changed
+718
-265
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
414 | | - | |
| 414 | + | |
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | 520 | | |
546 | 521 | | |
547 | 522 | | |
| |||
633 | 608 | | |
634 | 609 | | |
635 | 610 | | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
642 | 617 | | |
643 | 618 | | |
644 | 619 | | |
| |||
Lines changed: 0 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | 36 | | |
39 | 37 | | |
40 | 38 | | |
| |||
47 | 45 | | |
48 | 46 | | |
49 | 47 | | |
50 | | - | |
51 | 48 | | |
52 | | - | |
53 | | - | |
54 | 49 | | |
55 | 50 | | |
56 | 51 | | |
| |||
74 | 69 | | |
75 | 70 | | |
76 | 71 | | |
77 | | - | |
78 | 72 | | |
79 | | - | |
80 | | - | |
81 | 73 | | |
82 | 74 | | |
83 | 75 | | |
| |||
89 | 81 | | |
90 | 82 | | |
91 | 83 | | |
92 | | - | |
93 | 84 | | |
94 | 85 | | |
95 | 86 | | |
| |||
150 | 141 | | |
151 | 142 | | |
152 | 143 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | 144 | | |
157 | 145 | | |
158 | 146 | | |
| |||
179 | 167 | | |
180 | 168 | | |
181 | 169 | | |
182 | | - | |
183 | 170 | | |
184 | 171 | | |
185 | 172 | | |
| |||
198 | 185 | | |
199 | 186 | | |
200 | 187 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | 188 | | |
205 | 189 | | |
206 | 190 | | |
| |||
219 | 203 | | |
220 | 204 | | |
221 | 205 | | |
222 | | - | |
223 | 206 | | |
224 | 207 | | |
225 | 208 | | |
| |||
240 | 223 | | |
241 | 224 | | |
242 | 225 | | |
243 | | - | |
244 | | - | |
245 | 226 | | |
246 | 227 | | |
247 | 228 | | |
| |||
308 | 289 | | |
309 | 290 | | |
310 | 291 | | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | 292 | | |
315 | 293 | | |
316 | 294 | | |
| |||
345 | 323 | | |
346 | 324 | | |
347 | 325 | | |
348 | | - | |
349 | 326 | | |
350 | 327 | | |
351 | 328 | | |
| |||
366 | 343 | | |
367 | 344 | | |
368 | 345 | | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | 346 | | |
373 | 347 | | |
374 | 348 | | |
| |||
394 | 368 | | |
395 | 369 | | |
396 | 370 | | |
397 | | - | |
398 | 371 | | |
399 | 372 | | |
400 | 373 | | |
| |||
415 | 388 | | |
416 | 389 | | |
417 | 390 | | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | 391 | | |
422 | 392 | | |
423 | 393 | | |
| |||
433 | 403 | | |
434 | 404 | | |
435 | 405 | | |
436 | | - | |
437 | 406 | | |
438 | 407 | | |
439 | 408 | | |
| |||
0 commit comments