Skip to content

Conversation

@dfcoffin
Copy link
Contributor

@dfcoffin dfcoffin commented Jan 1, 2026

Summary

This PR resolves configuration inconsistencies between the CI/CD pipeline and TestContainers setup that would prevent PostgreSQL integration tests from running correctly when re-enabled.

Changes Made

1. Fixed Flyway Migration Paths ✅

Files Modified:

  • openespi-datacustodian/src/test/resources/application-testcontainers-postgresql.yml
  • openespi-thirdparty/src/test/resources/application-testcontainers-postgresql.yml

Before (BROKEN):

flyway:
  locations: classpath:db/migration/postgresql  # ← Path doesn't exist!

After (FIXED):

flyway:
  locations: classpath:db/migration,classpath:db/vendor/postgres  # ← Correct paths

Impact: Integration tests can now find and execute Flyway migrations when using testcontainers profile.

2. Upgraded PostgreSQL Version in CI/CD ✅

File Modified: .github/workflows/ci.yml

Before:

postgres:
  image: postgres:15

After:

postgres:
  image: postgres:18

Impact: Aligns CI/CD environment with TestContainers (both now use postgres:18).

3. Updated Test Documentation ✅

File Modified: openespi-common/src/test/java/.../DataCustodianApplicationPostgresTest.java

Updated @Disabled annotation to clearly document:

Test Results

Ran DataCustodianApplicationPostgresTest with all fixes applied:

✅ Issue #55 Configuration Fixed:

  • Flyway migrations execute successfully with correct paths
  • PostgreSQL 18 container starts and runs properly
  • All infrastructure configuration working correctly

❌ Issue #53 UUID Type Mismatch Still Blocks Tests:

Schema validation: wrong column type encountered in column [id] in table [aggregated_node_refs]; 
found [bpchar (Types#CHAR)], but expecting [uuid (Types#UUID)]

This confirms that Issue #55 and Issue #53 are separate problems:

Technical Details - Why Issue #53 Still Fails

Root Cause

JPA Entity Definition:

@GeneratedValue(strategy = GenerationType.UUID)  // Expects native PostgreSQL UUID type
private UUID id;

Flyway Migration:

CREATE TABLE aggregated_node_refs (
    id CHAR(36) PRIMARY KEY  -- Creates 36-character string for cross-DB compatibility
);

Schema Validation Failure:

  1. JPA expects: java.sql.Types.UUID (native 16-byte PostgreSQL UUID)
  2. Database has: java.sql.Types.CHAR (36-character string: "550e8400-e29b-41d4-a716-446655440000")
  3. Hibernate validation: Types.CHAR ≠ Types.UUIDFAIL

Why CHAR(36)? Cross-database compatibility with H2 and MySQL which lack native UUID support in base migrations.

Resolution Required: Create vendor-specific V4 PostgreSQL migration to convert all 91 CHAR(36) columns to native UUID type. This is postponed until after MULTI_PHASE schema compliance plan to avoid double work on tables that will be restructured.

Why Merge This PR Despite Tests Still Disabled?

  1. Fixes Real Bugs: Configuration issues will cause failures when tests are eventually re-enabled
  2. No Dependency: Configuration fixes are independent of Issue PostgreSQL TestContainers failing: UUID column type mismatch in migrations #53 schema changes
  3. Prepares Infrastructure: Sets up proper foundation for future UUID conversion
  4. Low Risk: Only configuration changes, no schema modifications
  5. Incremental Progress: Good engineering practice to fix known issues as discovered

Verification Steps

Before This PR:

# Broken Flyway path would cause:
mvn verify -Pintegration-tests -Dspring.profiles.active=testcontainers-postgresql
# ERROR: Cannot find migrations at classpath:db/migration/postgresql

After This PR:

# Flyway migrations execute successfully:
mvn verify -Pintegration-tests -Dspring.profiles.active=testcontainers-postgresql
# Migrations V1, V2, V3 execute ✅
# Schema validation fails due to Issue #53 UUID mismatch ❌

Related Issues

Checklist

  • Configuration files updated with correct Flyway migration paths
  • CI/CD PostgreSQL version upgraded to match TestContainers (postgres:18)
  • Test documentation updated to reflect current status
  • Changes tested - Flyway migrations execute successfully
  • Issue fix: PostgreSQL configuration mismatches between CI/CD and TestContainers #55 updated with detailed resolution status
  • Tests remain disabled per strategic decision to postpone UUID conversion

Next Steps (After This PR)

  1. ✅ Close Issue fix: PostgreSQL configuration mismatches between CI/CD and TestContainers #55 (configuration fixes complete)
  2. ⏳ Proceed with MULTI_PHASE schema compliance plan
  3. ⏳ After MULTI_PHASE: Create V4 migration for UUID conversion (Issue PostgreSQL TestContainers failing: UUID column type mismatch in migrations #53)
  4. ⏳ Re-enable PostgreSQL tests once Issue PostgreSQL TestContainers failing: UUID column type mismatch in migrations #53 is resolved

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

…peline

  and TestContainers setup that would prevent PostgreSQL integration tests
  from running correctly when re-enabled.

  ## Changes Made

  ### 1. Fixed Flyway Migration Paths
  - Files: application-testcontainers-postgresql.yml (datacustodian & thirdparty)
  - Before: classpath:db/migration/postgresql (non-existent path)
  - After: classpath:db/migration,classpath:db/vendor/postgres
  - Impact: Integration tests can now find and execute Flyway migrations

  ### 2. Upgraded PostgreSQL Version in CI/CD
  - File: .github/workflows/ci.yml
  - Before: postgres:15
  - After: postgres:18
  - Impact: Aligns CI/CD with TestContainers environment

  ### 3. Updated Test Documentation
  - File: DataCustodianApplicationPostgresTest.java
  - Updated @disabled annotation to reflect:
    - Configuration issues (Issue #55) are now RESOLVED
    - UUID type mismatch (Issue #53) still blocks test execution
    - Tests will be re-enabled after MULTI_PHASE schema compliance plan

  ## Test Results

  Verified that fixing Issue #55 configuration problems does NOT resolve
  Issue #53 UUID type mismatch. The test still fails with:

  Schema validation: wrong column type encountered in column [id];
  found [bpchar (Types#CHAR)], but expecting [uuid (Types#UUID)]

  This confirms Issue #53 requires V4 migration script to convert CHAR(36)
  columns to native UUID type, which will be implemented after MULTI_PHASE
  schema compliance plan completes.

  ## Related Issues

  - Fixes #55 - PostgreSQL configuration mismatches
  - Ref #53 - UUID CHAR(36) type mismatch (still blocking)

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

  Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>"
@dfcoffin dfcoffin merged commit 10e9172 into main Jan 2, 2026
5 checks passed
@dfcoffin dfcoffin deleted the fix/issue-55-postgres-config-mismatch branch January 2, 2026 05:37
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.

fix: PostgreSQL configuration mismatches between CI/CD and TestContainers

2 participants