From de887832f49f9fc6df4a68e6d622ed0c3d30e3ce Mon Sep 17 00:00:00 2001
From: Flavia Rainone <frainone@redhat.com>
Date: Sun, 20 Oct 2024 12:20:52 -0300
Subject: [PATCH] [UNDERTOW-2518] At WebSocketTimeoutTestCase, use a longer
 watch timeout 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 <frainone@redhat.com>
---
 .../websockets/core/protocol/WebSocketTimeoutTestCase.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/src/test/java/io/undertow/websockets/core/protocol/WebSocketTimeoutTestCase.java b/core/src/test/java/io/undertow/websockets/core/protocol/WebSocketTimeoutTestCase.java
index 08a4573550..b6ed4dd8c0 100644
--- a/core/src/test/java/io/undertow/websockets/core/protocol/WebSocketTimeoutTestCase.java
+++ b/core/src/test/java/io/undertow/websockets/core/protocol/WebSocketTimeoutTestCase.java
@@ -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);
 
@@ -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.");
             }
         }