JAVA-19152: fix intermittently failing RequestProcessorUnitTest (#13957)

This commit is contained in:
3hsan 2023-05-08 14:53:44 +02:00 committed by GitHub
parent f38b976997
commit bc19c39c52
1 changed files with 4 additions and 2 deletions

View File

@ -20,7 +20,8 @@ public class RequestProcessorUnitTest {
void whenWaitingWithThreadSleep_thenStatusIsDone() throws InterruptedException {
String requestId = requestProcessor.processRequest();
Thread.sleep(2000);
//The sleep value should be greater than the maximum time the request takes to complete
Thread.sleep(2010);
assertEquals("DONE", requestProcessor.getStatus(requestId));
}
@ -31,7 +32,8 @@ public class RequestProcessorUnitTest {
String requestId = requestProcessor.processRequest();
Awaitility.await()
.atMost(2, TimeUnit.SECONDS)
//The timeout value should be greater than the maximum time the request takes to complete
.atMost(2010, TimeUnit.MILLISECONDS)
.pollDelay(500, TimeUnit.MILLISECONDS)
.until(() -> requestProcessor.getStatus(requestId), not(equalTo("PROCESSING")));