Open
Description
I'm starting a mariadb image which starts mariadb twice (once for setup, once to serve requests). Unfortunately, there's no way to distinguish between those.
In 2.x; I could simply use container.waitForLog("mysqld: ready for connections.","mysqld: ready for connections.");
to wait for the both log lines. In 4.x this does not work anymore, it waits only for the 1st occurence.
Example Rule:
@ClassRule
public static DockerRule mysqlRule = new DockerRule(ImmutableDockerConfig.builder()
.image("mariadb:10.4")
.addCreateContainerConfigurer(create -> {
create.withName("baseapp-mariadb-" + UUID.randomUUID().toString());
create.withExposedPorts(mysqlPort);
create.withEnv("MYSQL_ROOT_PASSWORD=r", "MYSQL_DATABASE=db_meta");
})
.addHostConfigConfigurer(hostConfig -> {
hostConfig.withAutoRemove(true);
hostConfig.withPortBindings(new PortBinding(Binding.empty(), mysqlPort));
})
.addStartedListener(container -> {
// MySQL is started twice within the container - we need to wait for the startup message twice
container.waitForLog("mysqld: ready for connections.","mysqld: ready for connections.");
container.waitForPort(mysqlPort);
})
.build());
Metadata
Metadata
Assignees
Labels
No labels