From 955c1418dd83d4ca2506c218363195b8cc615b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niclas=20Ro=C3=9Fberger?= Date: Wed, 7 May 2025 14:31:42 +0200 Subject: [PATCH] fix: start with wait for health-check resolving to early when using colima on macos #997 --- packages/modules/cassandra/src/cassandra-container.ts | 4 +++- packages/modules/cockroachdb/src/cockroachdb-container.ts | 2 +- packages/modules/postgresql/src/postgresql-container.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/modules/cassandra/src/cassandra-container.ts b/packages/modules/cassandra/src/cassandra-container.ts index dfc68b431..13f7a9e51 100644 --- a/packages/modules/cassandra/src/cassandra-container.ts +++ b/packages/modules/cassandra/src/cassandra-container.ts @@ -10,7 +10,9 @@ export class CassandraContainer extends GenericContainer { constructor(image = "cassandra:5.0.2") { super(image); - this.withExposedPorts(CASSANDRA_PORT).withWaitStrategy(Wait.forHealthCheck()).withStartupTimeout(120_000); + this.withExposedPorts(CASSANDRA_PORT) + .withWaitStrategy(Wait.forAll([Wait.forHealthCheck(), Wait.forListeningPorts()])) + .withStartupTimeout(120_000); } public withDatacenter(dc: string): this { diff --git a/packages/modules/cockroachdb/src/cockroachdb-container.ts b/packages/modules/cockroachdb/src/cockroachdb-container.ts index eef0008d9..290b905e4 100755 --- a/packages/modules/cockroachdb/src/cockroachdb-container.ts +++ b/packages/modules/cockroachdb/src/cockroachdb-container.ts @@ -11,7 +11,7 @@ export class CockroachDbContainer extends GenericContainer { super(image); this.withExposedPorts(COCKROACH_PORT, COCKROACH_HTTP_PORT) .withCommand(["start-single-node", "--insecure", `--http-addr=0.0.0.0:${COCKROACH_HTTP_PORT}`]) - .withWaitStrategy(Wait.forHealthCheck()); + .withWaitStrategy(Wait.forAll([Wait.forHealthCheck(), Wait.forListeningPorts()])); } public withDatabase(database: string): this { diff --git a/packages/modules/postgresql/src/postgresql-container.ts b/packages/modules/postgresql/src/postgresql-container.ts index 9bd774008..57b0d698a 100755 --- a/packages/modules/postgresql/src/postgresql-container.ts +++ b/packages/modules/postgresql/src/postgresql-container.ts @@ -10,7 +10,7 @@ export class PostgreSqlContainer extends GenericContainer { constructor(image = "postgres:13.3-alpine") { super(image); this.withExposedPorts(POSTGRES_PORT); - this.withWaitStrategy(Wait.forHealthCheck()); + this.withWaitStrategy(Wait.forAll([Wait.forHealthCheck(), Wait.forListeningPorts()])); this.withStartupTimeout(120_000); }