Skip to content

Commit

Permalink
Fix await during DockerClientProviderStrategy test method (#9412)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAure authored Oct 22, 2024
1 parent 8a50d01 commit 119627f
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketTimeoutException;
import java.net.URI;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
Expand Down Expand Up @@ -207,14 +206,12 @@ protected boolean test() {
}

try (Socket socket = socketProvider.call()) {
Duration timeout = Duration.ofMillis(200);
Awaitility
.await()
.atMost(TestcontainersConfiguration.getInstance().getClientPingTimeout(), TimeUnit.SECONDS)
.pollInterval(timeout)
.atMost(TestcontainersConfiguration.getInstance().getClientPingTimeout(), TimeUnit.SECONDS) // timeout after configured duration
.pollInterval(Duration.ofMillis(200)) // check state every 200ms
.pollDelay(Duration.ofSeconds(0)) // start checking immediately
.ignoreExceptionsInstanceOf(SocketTimeoutException.class)
.untilAsserted(() -> socket.connect(socketAddress, (int) timeout.toMillis()));
.untilAsserted(() -> socket.connect(socketAddress));
return true;
} catch (Exception e) {
log.warn("DOCKER_HOST {} is not listening", dockerHost, e);
Expand Down

0 comments on commit 119627f

Please sign in to comment.