This is an automated email from the ASF dual-hosted git repository.
rjung pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 8ec7ce32e4 Improve websocket junit test timing behavior.
8ec7ce32e4 is described below
commit 8ec7ce32e4b51b2c52012bb2e26baec3b842ee59
Author: Rainer Jung <[email protected]>
AuthorDate: Thu Apr 18 13:28:21 2024 +0200
Improve websocket junit test timing behavior.
Since 11.0.0-M17 soome tests hit the default session close timeout
of 30 seconds at the end of test.
Set a session close timeout of 2 seconds for these tests instead.
---
test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java | 6 ++++++
.../tomcat/websocket/TestWsWebSocketContainerTimeoutServer.java | 3 +++
test/org/apache/tomcat/websocket/server/TestSlowClient.java | 3 +++
.../websocket/server/TestWsRemoteEndpointImplServerDeadlock.java | 3 +++
4 files changed, 15 insertions(+)
diff --git a/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java
b/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java
index 0853d1397c..0447e3a549 100644
--- a/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java
+++ b/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java
@@ -142,6 +142,9 @@ public class TestWebSocketFrameClientSSL extends
WebSocketBaseTest {
Session wsSession =
wsContainer.connectToServer(TesterProgrammaticEndpoint.class,
clientEndpointConfig,
new URI("wss://localhost:" + getPort() +
TesterFirehoseServer.PATH));
+ // Set a short session close timeout (milliseconds)
+ wsSession.getUserProperties().put(
+
org.apache.tomcat.websocket.Constants.SESSION_CLOSE_TIMEOUT_PROPERTY,
Long.valueOf(2000));
CountDownLatch latch = new
CountDownLatch(TesterFirehoseServer.MESSAGE_COUNT);
BasicText handler = new BasicText(latch);
wsSession.addMessageHandler(handler);
@@ -282,6 +285,9 @@ public class TestWebSocketFrameClientSSL extends
WebSocketBaseTest {
Assert.fail("There are [" + openConnectionCount + "] connections
still open");
}
+ // Set a short session close timeout (milliseconds)
+ wsSession.getUserProperties().put(
+
org.apache.tomcat.websocket.Constants.SESSION_CLOSE_TIMEOUT_PROPERTY,
Long.valueOf(2000));
// Close the client session.
wsSession.close();
}
diff --git
a/test/org/apache/tomcat/websocket/TestWsWebSocketContainerTimeoutServer.java
b/test/org/apache/tomcat/websocket/TestWsWebSocketContainerTimeoutServer.java
index b3b31b699c..613fadde8c 100644
---
a/test/org/apache/tomcat/websocket/TestWsWebSocketContainerTimeoutServer.java
+++
b/test/org/apache/tomcat/websocket/TestWsWebSocketContainerTimeoutServer.java
@@ -100,6 +100,9 @@ public class TestWsWebSocketContainerTimeoutServer extends
WsWebSocketContainerB
loops++;
}
+ // Set a short session close timeout (milliseconds)
+ wsSession.getUserProperties().put(
+
org.apache.tomcat.websocket.Constants.SESSION_CLOSE_TIMEOUT_PROPERTY,
Long.valueOf(2000));
// Close the client session, primarily to allow the
// BackgroundProcessManager to shut down.
wsSession.close();
diff --git a/test/org/apache/tomcat/websocket/server/TestSlowClient.java
b/test/org/apache/tomcat/websocket/server/TestSlowClient.java
index 411c395045..a9203609f5 100644
--- a/test/org/apache/tomcat/websocket/server/TestSlowClient.java
+++ b/test/org/apache/tomcat/websocket/server/TestSlowClient.java
@@ -70,6 +70,9 @@ public class TestSlowClient extends WebSocketBaseTest {
count++;
}
Assert.assertTrue(wsSession.isOpen());
+ // Set a short session close timeout (milliseconds)
+ wsSession.getUserProperties().put(
+
org.apache.tomcat.websocket.Constants.SESSION_CLOSE_TIMEOUT_PROPERTY,
Long.valueOf(2000));
wsSession.close();
// BZ 64848 (non-container thread variant)
diff --git
a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java
b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java
index 7959daa38c..86adf1ac1d 100644
---
a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java
+++
b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServerDeadlock.java
@@ -124,6 +124,9 @@ public class TestWsRemoteEndpointImplServerDeadlock extends
WebSocketBaseTest {
// Server buffers are full. Server cannot send any more messages.
// Server is now blocked waiting for the client to read the messages.
+ // Set a short session close timeout (milliseconds)
+ session.getUserProperties().put(
+
org.apache.tomcat.websocket.Constants.SESSION_CLOSE_TIMEOUT_PROPERTY,
Long.valueOf(2000));
// Close the session from the client
session.close();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]