Skip to content

Waiting for the same log line twice does not work anymore #7

Open
@micw

Description

@micw

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions