Issue #8895 - fixing JettyHomeTester.await logs timeout

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2022-11-15 18:51:10 -06:00
parent af227778bb
commit fd558f2eaa
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 4 additions and 4 deletions

View File

@ -558,8 +558,8 @@ public class JettyHomeTester
*/ */
public boolean awaitConsoleLogsFor(String txt, long time, TimeUnit unit) throws InterruptedException public boolean awaitConsoleLogsFor(String txt, long time, TimeUnit unit) throws InterruptedException
{ {
long start = System.currentTimeMillis(); long end = System.currentTimeMillis() + unit.toMillis(time);
while (start < unit.toMillis(time)) while (System.currentTimeMillis() < end)
{ {
boolean result = logs.stream().anyMatch(s -> s.contains(txt)); boolean result = logs.stream().anyMatch(s -> s.contains(txt));
if (result) if (result)
@ -586,8 +586,8 @@ public class JettyHomeTester
thread.start(); thread.start();
try try
{ {
long start = System.currentTimeMillis(); long end = System.currentTimeMillis() + unit.toMillis(time);
while (start < unit.toMillis(time)) while (System.currentTimeMillis() < end)
{ {
boolean result = logs.stream().anyMatch(s -> s.contains(txt)); boolean result = logs.stream().anyMatch(s -> s.contains(txt));
if (result) if (result)