Skip to content

Commit b716252

Browse files
authored
Wait for postgres to start in r2dbc tests (#8450)
1 parent 48688b8 commit b716252

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

instrumentation/r2dbc-1.0/testing/src/main/java/io/opentelemetry/instrumentation/r2dbc/v1_0/AbstractR2dbcStatementTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.slf4j.LoggerFactory;
4343
import org.testcontainers.containers.GenericContainer;
4444
import org.testcontainers.containers.output.Slf4jLogConsumer;
45+
import org.testcontainers.containers.wait.strategy.Wait;
4546
import reactor.core.publisher.Mono;
4647

4748
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@@ -114,6 +115,10 @@ void startContainer(DbSystemProps props) {
114115
.withExposedPorts(props.port)
115116
.withLogConsumer(new Slf4jLogConsumer(logger))
116117
.withStartupTimeout(Duration.ofMinutes(2));
118+
if (props == POSTGRESQL) {
119+
container.waitingFor(
120+
Wait.forLogMessage(".*database system is ready to accept connections.*", 2));
121+
}
117122
container.start();
118123
port = container.getMappedPort(props.port);
119124
}

0 commit comments

Comments
 (0)