From 06fe6e583129144cb5d7493531be0e6fd97adb9c Mon Sep 17 00:00:00 2001 From: Robert Stupp Date: Mon, 3 Apr 2023 09:23:44 +0200 Subject: [PATCH] Update Test timeouts for Windows --- .../ContinuousTestingMavenTestUtils.java | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/test-framework/maven/src/main/java/io/quarkus/maven/it/continuoustesting/ContinuousTestingMavenTestUtils.java b/test-framework/maven/src/main/java/io/quarkus/maven/it/continuoustesting/ContinuousTestingMavenTestUtils.java index 477a6036033c8..04db384b97daf 100644 --- a/test-framework/maven/src/main/java/io/quarkus/maven/it/continuoustesting/ContinuousTestingMavenTestUtils.java +++ b/test-framework/maven/src/main/java/io/quarkus/maven/it/continuoustesting/ContinuousTestingMavenTestUtils.java @@ -4,11 +4,8 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Arrays; -import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; import org.awaitility.Awaitility; import org.awaitility.core.ConditionTimeoutException; @@ -42,36 +39,33 @@ public ContinuousTestingMavenTestUtils(URL url) { } public TestStatus waitForNextCompletion() { - try (CloseableHttpClient client = HttpClientBuilder.create().build()) { - Awaitility.waitAtMost(1, TimeUnit.MINUTES).pollInterval(50, TimeUnit.MILLISECONDS).until(new Callable() { - @Override - public Boolean call() throws Exception { - TestStatus ts = objectMapper.readValue(url, TestStatus.class); - if (ts.getLastRun() > runtToWaitFor) { - throw new RuntimeException( - "Waiting for run " + runtToWaitFor + " but run " + ts.getLastRun() + " has already occurred"); - } - boolean runComplete = ts.getLastRun() == runtToWaitFor; - if (runComplete && ts.getRunning() > 0) { - //there is a small chance of a race, where changes are picked up twice, due to how filesystems work - //this works around it by waiting for the next run - runtToWaitFor = ts.getRunning(); - return false; - } else if (runComplete) { - runtToWaitFor++; - } - return runComplete; + try { + Awaitility.waitAtMost(2, TimeUnit.MINUTES).pollInterval(200, TimeUnit.MILLISECONDS).until(() -> { + TestStatus ts = objectMapper.readValue(url, TestStatus.class); + if (ts.getLastRun() > runtToWaitFor) { + throw new RuntimeException( + "Waiting for run " + runtToWaitFor + " but run " + ts.getLastRun() + " has already occurred"); + } + boolean runComplete = ts.getLastRun() == runtToWaitFor; + if (runComplete && ts.getRunning() > 0) { + //there is a small chance of a race, where changes are picked up twice, due to how filesystems work + //this works around it by waiting for the next run + runtToWaitFor = ts.getRunning(); + return false; + } else if (runComplete) { + runtToWaitFor++; } + return runComplete; }); return objectMapper.readValue(url, TestStatus.class); } catch (Exception e) { - TestStatus ts = null; + TestStatus ts; try { ts = objectMapper.readValue(url, TestStatus.class); } catch (IOException ex) { throw new RuntimeException(ex); } - throw new ConditionTimeoutException("Failed to wait for test run" + runtToWaitFor + " " + ts); + throw new ConditionTimeoutException("Failed to wait for test run " + runtToWaitFor + " " + ts, e); } }