-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Description
Critical configuration mismatches exist between the CI/CD pipeline and local TestContainers setup that prevent proper PostgreSQL integration testing. These mismatches explain why PostgreSQL tests may pass locally for some team members but fail in CI/CD environments.
Configuration Mismatches Identified
1. PostgreSQL Version Mismatch ⚠️
CI/CD Pipeline (.github/workflows/ci.yml:33):
postgres:
image: postgres:15 # ← CI/CD uses PostgreSQL 15TestContainers (openespi-common/src/test/java/.../DataCustodianApplicationPostgresTest.java:60):
static PostgreSQLContainer postgresContainer = new PostgreSQLContainer("postgres:18")2. Flyway Migration Locations - CRITICAL 🔴
Incorrect Configuration in testcontainers profiles:
openespi-datacustodian/src/test/resources/application-testcontainers-postgresql.yml:29openespi-thirdparty/src/test/resources/application-testcontainers-postgresql.yml:29
flyway:
locations: classpath:db/migration/postgresql # ← WRONG - this path does NOT exist!Correct Configuration (openespi-common/src/test/resources/application-test-postgresql.yml:19):
flyway:
locations: classpath:db/migration,classpath:db/vendor/postgresActual Migration Structure:
openespi-common/src/main/resources/db/
├── migration/
│ ├── V1__Create_Base_Tables.sql
│ └── V3__Create_additiional_Base_Tables.sql
└── vendor/
├── h2/V2__H2_Specific_Tables.sql
├── mysql/V2__MySQL_Specific_Tables.sql
└── postgres/V2__PostgreSQL_Specific_Tables.sql
Why Tests Pass Locally
The DataCustodianApplicationPostgresTest programmatically overrides the incorrect testcontainers profile configuration:
@DynamicPropertySource
static void configureProperties(DynamicPropertyRegistry registry) {
// Correct Flyway paths injected at runtime
registry.add("spring.flyway.locations",
() -> "classpath:db/migration,classpath:db/vendor/postgres");
}This means:
- ✅ Running
DataCustodianApplicationPostgresTest.javadirectly → PASSES (uses correct paths via@DynamicPropertySource) - ❌ Running with
mvn verify -Pintegration-tests→ FAILS (uses incorrect paths fromapplication-testcontainers-postgresql.yml) ⚠️ Currently disabled via@Disabledannotation due to Issue PostgreSQL TestContainers failing: UUID column type mismatch in migrations #53
Impact
- Integration tests using the
testcontainersprofile will fail because Flyway cannot find migrations - PostgreSQL version inconsistency between CI/CD and local testing environments
- False positives - tests appear to pass locally because
@DynamicPropertySourceoverrides broken configuration - Hidden from CI/CD - PostgreSQL tests currently disabled due to Issue PostgreSQL TestContainers failing: UUID column type mismatch in migrations #53, masking these configuration issues
Recommended Resolution
Phase 1: Fix Flyway Configuration (Immediate)
Update the following files to use correct Flyway migration paths:
File 1: openespi-datacustodian/src/test/resources/application-testcontainers-postgresql.yml
flyway:
enabled: true
baseline-on-migrate: true
locations: classpath:db/migration,classpath:db/vendor/postgres # ← Fix pathFile 2: openespi-thirdparty/src/test/resources/application-testcontainers-postgresql.yml
flyway:
enabled: true
baseline-on-migrate: true
locations: classpath:db/migration,classpath:db/vendor/postgres # ← Fix pathPhase 2: Align PostgreSQL Versions (Recommended)
Update CI/CD to match TestContainers version:
File: .github/workflows/ci.yml:33
postgres:
image: postgres:18 # ← Upgrade from postgres:15 to postgres:18Rationale:
- Ensures environment consistency between CI/CD and local testing
- PostgreSQL 18 is the latest stable release
- Aligns with existing TestContainers configuration
Phase 3: Post-Issue #53 Resolution
After Issue #53 (UUID CHAR(36) type mismatch) is resolved via the MULTI_PHASE schema compliance plan:
- Remove
@Disabledannotation fromDataCustodianApplicationPostgresTest - Verify integration tests pass with corrected Flyway paths
- Validate both CI/CD and local environments produce consistent results
Related Issues
- PostgreSQL TestContainers failing: UUID column type mismatch in migrations #53 - PostgreSQL UUID CHAR(36) type mismatch (blocking test execution)
Files Requiring Changes
-
.github/workflows/ci.yml- Update postgres image to version 18 -
openespi-datacustodian/src/test/resources/application-testcontainers-postgresql.yml- Fix Flyway locations -
openespi-thirdparty/src/test/resources/application-testcontainers-postgresql.yml- Fix Flyway locations
Acceptance Criteria
- All testcontainers-postgresql.yml files use correct Flyway migration paths
- CI/CD PostgreSQL version matches TestContainers (postgres:18)
- Integration tests run successfully with
mvn verify -Pintegration-tests -Dspring.profiles.active=testcontainers-postgresql - Configuration mismatches documented and resolved
- Tests remain disabled until Issue PostgreSQL TestContainers failing: UUID column type mismatch in migrations #53 is resolved (to avoid UUID type mismatch failures)
Priority
Medium - These issues are currently masked by disabled PostgreSQL tests, but must be resolved before re-enabling PostgreSQL integration testing after Issue #53 is fixed.