Add SSL support for postgres containers by cristianrgreco · Pull Request #1224 · testcontainers/testcontainers-node

Skip to content

Navigation Menu

Sign in

Appearance settings

Conversation

@cristianrgreco

Summary

  • add opt-in SSL helpers to PostgreSqlContainer: withSSL(certFile, keyFile, caCertFile?) and withSSLCert(caCertFile, certFile, keyFile)
  • copy SSL material into the container and use a small entrypoint wrapper to fix postgres file ownership before startup
  • enable postgres SSL via -c flags only when SSL is configured
  • add SSL integration coverage for postgres + postgis + pgvector + timescale variants
  • add test cert fixtures plus a test-certs/generate-certs.sh script and docs note/example

Verification

  • npm test -- packages/modules/postgresql/src/postgresql-container.test.ts packages/modules/postgresql/src/postgresql-container-snapshot.test.ts packages/modules/postgresql/src/postgis-container.test.ts packages/modules/postgresql/src/pgvector-container.test.ts packages/modules/postgresql/src/timescale-container.test.ts
  • Coverage includes:
    • PostgreSQL base container
    • Snapshot/restore behavior
    • PostGIS variant
    • PGVector variant
    • Timescale variant

Result

  • Test files: 5 passed
  • Tests: 21 passed

Closes #1113

@netlify

@cristianrgreco cristianrgreco changed the title feat(postgresql): add opt-in SSL support for postgres containers Add opt-in SSL support for postgres containers

Feb 17, 2026

@cristianrgreco cristianrgreco changed the title Add opt-in SSL support for postgres containers Add SSL support for postgres containers

Feb 17, 2026

Labels

1 participant

@cristianrgreco