Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
micw opened this issue Jul 6, 2020 · 0 comments
Open

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

micw opened this issue Jul 6, 2020 · 0 comments

Comments

@micw
Copy link

micw commented Jul 6, 2020

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());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant