From f36c8cf55ff2e5a08b66b77afedf791da8bd5e06 Mon Sep 17 00:00:00 2001 From: Phillip Ross Date: Sat, 16 May 2020 00:22:13 -0400 Subject: [PATCH] Calculate and specify a wait-for-it timeout --- .../cube/docker/impl/await/PollingAwaitStrategy.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docker/docker/src/main/java/org/arquillian/cube/docker/impl/await/PollingAwaitStrategy.java b/docker/docker/src/main/java/org/arquillian/cube/docker/impl/await/PollingAwaitStrategy.java index 39b0ca297..cd1758d3a 100644 --- a/docker/docker/src/main/java/org/arquillian/cube/docker/impl/await/PollingAwaitStrategy.java +++ b/docker/docker/src/main/java/org/arquillian/cube/docker/impl/await/PollingAwaitStrategy.java @@ -13,6 +13,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.TimeUnit; import java.util.logging.Logger; import org.arquillian.cube.docker.impl.client.config.Await; import org.arquillian.cube.docker.impl.docker.DockerClientExecutor; @@ -214,7 +215,12 @@ private Set getScriptPermissions() { } private String resolveWaitForItCommand(String containerIp, int port) { - return String.format("%s/%s %s:%s -s -- echo %s", CONTAINER_DIRECTORY, WAIT_FOR_IT_SCRIPT, containerIp, port, + final long waitForItSleepSeconds = TimeUnit.SECONDS.convert( + pollIterations * getSleepTime(), + getTimeUnit() + ); + return String.format("%s/%s %s:%s -s -t %s -- echo %s", CONTAINER_DIRECTORY, WAIT_FOR_IT_SCRIPT, containerIp, port, + waitForItSleepSeconds, MESSAGE); }