From fd558f2eaaaae49ec220a2e39b85ce3f4cae07b1 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 15 Nov 2022 18:51:10 -0600 Subject: [PATCH] Issue #8895 - fixing JettyHomeTester.await logs timeout Signed-off-by: Joakim Erdfelt --- .../eclipse/jetty/tests/hometester/JettyHomeTester.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/jetty-home-tester/src/main/java/org/eclipse/jetty/tests/hometester/JettyHomeTester.java b/tests/jetty-home-tester/src/main/java/org/eclipse/jetty/tests/hometester/JettyHomeTester.java index 7f502774c0b..e8aa5f15380 100644 --- a/tests/jetty-home-tester/src/main/java/org/eclipse/jetty/tests/hometester/JettyHomeTester.java +++ b/tests/jetty-home-tester/src/main/java/org/eclipse/jetty/tests/hometester/JettyHomeTester.java @@ -558,8 +558,8 @@ public class JettyHomeTester */ public boolean awaitConsoleLogsFor(String txt, long time, TimeUnit unit) throws InterruptedException { - long start = System.currentTimeMillis(); - while (start < unit.toMillis(time)) + long end = System.currentTimeMillis() + unit.toMillis(time); + while (System.currentTimeMillis() < end) { boolean result = logs.stream().anyMatch(s -> s.contains(txt)); if (result) @@ -586,8 +586,8 @@ public class JettyHomeTester thread.start(); try { - long start = System.currentTimeMillis(); - while (start < unit.toMillis(time)) + long end = System.currentTimeMillis() + unit.toMillis(time); + while (System.currentTimeMillis() < end) { boolean result = logs.stream().anyMatch(s -> s.contains(txt)); if (result)