You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We were previously using test-containers version 1.17.3.
When we switched to 1.19.7 some of our tests stopped working because the behaviour of GenericContainer.setWaitStrategy changed.
Our Code looked roughly like this:
postgreDBContainer = new PostgreSQLContainer<>(postgresImage).withExposedPorts(5432).withUsername("feature")
.withPassword("xxx").withDatabaseName("xxx");
postgreDBContainer.setWaitStrategy(
new LogMessageWaitStrategy().withRegEx(".*database system is ready to accept connections.*")
.withTimes(1).withStartupTimeout(Duration.of(60, SECONDS)));
After the upgrade, the waitstrategy provided is no longer used.
I wrote a Test for this that can be copy-pasted into GenericContainerTest.java
@Test
public void shouldUseLatestWaitStrategy(){
try (GenericContainer<?> container = new GenericContainer<>("testcontainers/helloworld:1.1.0")) {
WaitForExitedState strategy1 = new WaitForExitedState(state -> false);
WaitForExitedState strategy2 = new WaitForExitedState(state -> true);
container.waitingFor(strategy1);
container.setWaitStrategy(strategy2);
assertThat(container.getWaitStrategy()).isEqualTo(strategy2);
}
}
I think the problem is because .waitingFor changes the field in GenericContainer, but setWaitStrategy changes it in GenericContainer.containerDef.
The PostgreSQLContainer-Constructor sets this.waitStrategy. After that it can no longer be changed by calling setWaitStrategy.
Relevant log output
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Module
Core
Testcontainers version
1.19.7
Using the latest Testcontainers version?
Yes
Host OS
MacOs
Host Arch
ARM
Docker version
What happened?
We were previously using test-containers version 1.17.3.
When we switched to 1.19.7 some of our tests stopped working because the behaviour of GenericContainer.setWaitStrategy changed.
Our Code looked roughly like this:
After the upgrade, the waitstrategy provided is no longer used.
I wrote a Test for this that can be copy-pasted into GenericContainerTest.java
I think the problem is because .waitingFor changes the field in GenericContainer, but setWaitStrategy changes it in GenericContainer.containerDef.
The PostgreSQLContainer-Constructor sets this.waitStrategy. After that it can no longer be changed by calling setWaitStrategy.
Relevant log output
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: