Skip to content

Commit 6059491

Browse files
authored
Add Wait.forListeningPorts to Cassandra/Cockroach/Postgres modules (#998)
1 parent 4471f40 commit 6059491

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/modules/cassandra/src/cassandra-container.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ export class CassandraContainer extends GenericContainer {
1010

1111
constructor(image = "cassandra:5.0.2") {
1212
super(image);
13-
this.withExposedPorts(CASSANDRA_PORT).withWaitStrategy(Wait.forHealthCheck()).withStartupTimeout(120_000);
13+
this.withExposedPorts(CASSANDRA_PORT)
14+
.withWaitStrategy(Wait.forAll([Wait.forHealthCheck(), Wait.forListeningPorts()]))
15+
.withStartupTimeout(120_000);
1416
}
1517

1618
public withDatacenter(dc: string): this {

packages/modules/cockroachdb/src/cockroachdb-container.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class CockroachDbContainer extends GenericContainer {
1111
super(image);
1212
this.withExposedPorts(COCKROACH_PORT, COCKROACH_HTTP_PORT)
1313
.withCommand(["start-single-node", "--insecure", `--http-addr=0.0.0.0:${COCKROACH_HTTP_PORT}`])
14-
.withWaitStrategy(Wait.forHealthCheck());
14+
.withWaitStrategy(Wait.forAll([Wait.forHealthCheck(), Wait.forListeningPorts()]));
1515
}
1616

1717
public withDatabase(database: string): this {

packages/modules/postgresql/src/postgresql-container.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class PostgreSqlContainer extends GenericContainer {
1010
constructor(image = "postgres:13.3-alpine") {
1111
super(image);
1212
this.withExposedPorts(POSTGRES_PORT);
13-
this.withWaitStrategy(Wait.forHealthCheck());
13+
this.withWaitStrategy(Wait.forAll([Wait.forHealthCheck(), Wait.forListeningPorts()]));
1414
this.withStartupTimeout(120_000);
1515
}
1616

0 commit comments

Comments
 (0)