testcontainers-node: Potential regression due to healthcheck wait strategy change?

Expected Behaviour

We have a docker compose stack that we manage through testcontainers. Previous to v10.11.0, the stack came up normally.

Actual Behaviour

With v10.11.0, the stack fails to come up with a health check timeout.

Testcontainer Logs

Error: Health check not healthy after 60000ms

    at Timeout._onTimeout (/home/runner/work/monorepo/monorepo/node_modules/.pnpm/testcontainers@10.11.0/node_modules/testcontainers/src/wait-strategies/health-check-wait-strategy.ts:18:16)

Steps to Reproduce

  1. Setup a docker compose file with health checks.
  2. Call await new DockerComposeEnvironment(composeFilePath, 'docker-compose.yml').withWaitStrategy('foo-1', Wait.forHealthCheck()).up();
  3. Observe the timeout.

Environment Information

  • Operating System:
  • Docker Version:
  • Node version:
  • Testcontainers version: v10.11.0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

It was previously implemented like that @kiview. I was hoping instead of polling we could instead get notified when it’s ready. However looks like we can’t make any guarantees based on the event stream. I’ll likely have to rollback this change

@andersfischernielsen Interesting, since I did not think that this error came from the actual Postgres container (it was never created for me), but from Ryuk.

If it is indeed Ryuk, disabling it can also help:

TESTCONTAINERS_RYUK_DISABLED=true

I think I can replicate this same issue using bun.sh as a runtime (possibly because of how much faster it is than node?) while trying to use testcontainers in a test setup

I’m simply running this file with bun and the container setup will fail the second or third time (once the image has been fetched) and running it with DEBUG=testcontainers* reveals the same issue that it cannot find the Started! log despite the fact that I can verify it manually

import { PostgreSqlContainer } from '@testcontainers/postgresql';

await new PostgreSqlContainer('postgres:17.0').start();