Skip to content

Postgres health check broken with postgis image #971

@fnberta

Description

@fnberta

Expected Behaviour
Tests wait to run until database is ready when using postgis/postgis:16-3.4 image. This worked fine until the change in #914. If I manually revert back to .withWaitStrategy(Wait.forLogMessage(/.*database system is ready to accept connections.*/, 2)) things work again.

Actual Behaviour
Tests fail with ECONNRESET.

Testcontainer Logs
2025-04-03T07:36:27.386Z testcontainers:containers [20fef8e572f9] 2025-04-03 07:36:27.385 UTC [70] LOG: database system is ready to accept connections
2025-04-03T07:36:27.422Z testcontainers:containers [20fef8e572f9] done
2025-04-03T07:36:27.422Z testcontainers:containers [20fef8e572f9] server started
2025-04-03T07:36:27.700Z testcontainers:containers [20fef8e572f9] 2025-04-03 07:36:27.699 UTC [89] FATAL: database "test" does not exist
2025-04-03T07:36:27.728Z testcontainers:containers [20fef8e572f9] CREATE DATABASE
2025-04-03T07:36:27.730Z testcontainers:containers [20fef8e572f9]
2025-04-03T07:36:27.732Z testcontainers:containers [20fef8e572f9]
2025-04-03T07:36:27.732Z testcontainers:containers [20fef8e572f9] /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/V01__postgis.sql
2025-04-03T07:36:28.126Z testcontainers [DEBUG] [20fef8e572f9] Health check wait strategy complete
2025-04-03T07:36:28.126Z testcontainers [INFO] [20fef8e572f9] Container is ready

Steps to Reproduce
Use PostgreSqlContainer with postgis/postgis:16-3.4 and try to connect to the container.

Environment Information

  • Operating System: MacOS
  • Docker Version: 4.39.0 (184744)
  • Node version: v22.6.0
  • Testcontainers version: 10.23.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions