Wait for postgres to start in r2dbc tests (#8450)

This commit is contained in:
Lauri Tulmin 2023-05-09 19:00:07 +03:00 committed by GitHub
parent 48688b8f37
commit b71625276b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -42,6 +42,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.Wait;
import reactor.core.publisher.Mono;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ -114,6 +115,10 @@ public abstract class AbstractR2dbcStatementTest {
.withExposedPorts(props.port)
.withLogConsumer(new Slf4jLogConsumer(logger))
.withStartupTimeout(Duration.ofMinutes(2));
if (props == POSTGRESQL) {
container.waitingFor(
Wait.forLogMessage(".*database system is ready to accept connections.*", 2));
}
container.start();
port = container.getMappedPort(props.port);
}