Skip to content

Commit

Permalink
[UNDERTOW-2518] At WebSocketTimeoutTestCase, use a longer watch timeo…
Browse files Browse the repository at this point in the history
…ut to verify if the timeout is working, and increase the interval of tolerance for the time spent

This may work better on slower machines when running this test.

Signed-off-by: Flavia Rainone <[email protected]>
  • Loading branch information
fl4via committed Oct 21, 2024
1 parent 62689fe commit de88783
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected void onFullTextMessage(WebSocketChannel channel, BufferedTextMessage m
latch.getIoFuture().get();

final long watchStart = System.currentTimeMillis();
final long watchTimeout = System.currentTimeMillis() + TESTABLE_TIMEOUT_VALUE + 500;
final long watchTimeout = System.currentTimeMillis() + TESTABLE_TIMEOUT_VALUE + 1000;
final FutureResult<Long> timeoutLatch = new FutureResult<Long>();
ReadTimeoutChannelGuard readTimeoutChannelGuard = new ReadTimeoutChannelGuard(client, timeoutLatch, watchTimeout);

Expand All @@ -124,7 +124,7 @@ protected void onFullTextMessage(WebSocketChannel channel, BufferedTextMessage m
} else {
long timeSpent = watchTimeEnd - watchStart;
//let's be generous and give 150ms diff( there is "fuzz" coded for 50ms in undertow as well
if(!(timeSpent <= TESTABLE_TIMEOUT_VALUE + 150)) {
if(!(timeSpent <= TESTABLE_TIMEOUT_VALUE + 250)) {
Assert.fail("Timeout did not happen... in time. Socket timeout out in '" + timeSpent + "' ms, supposed to happen in '" + TESTABLE_TIMEOUT_VALUE + "' ms.");
}
}
Expand Down

0 comments on commit de88783

Please sign in to comment.