JAVA-19152: fix intermittently failing RequestProcessorUnitTest (#13957)
This commit is contained in:
parent
f38b976997
commit
bc19c39c52
@ -20,7 +20,8 @@ public class RequestProcessorUnitTest {
|
|||||||
void whenWaitingWithThreadSleep_thenStatusIsDone() throws InterruptedException {
|
void whenWaitingWithThreadSleep_thenStatusIsDone() throws InterruptedException {
|
||||||
String requestId = requestProcessor.processRequest();
|
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));
|
assertEquals("DONE", requestProcessor.getStatus(requestId));
|
||||||
}
|
}
|
||||||
@ -31,7 +32,8 @@ public class RequestProcessorUnitTest {
|
|||||||
String requestId = requestProcessor.processRequest();
|
String requestId = requestProcessor.processRequest();
|
||||||
|
|
||||||
Awaitility.await()
|
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)
|
.pollDelay(500, TimeUnit.MILLISECONDS)
|
||||||
.until(() -> requestProcessor.getStatus(requestId), not(equalTo("PROCESSING")));
|
.until(() -> requestProcessor.getStatus(requestId), not(equalTo("PROCESSING")));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user