This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 1997379b56 Make test more robust
1997379b56 is described below
commit 1997379b56489976a7b6196fb1bfd999f44e9944
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Jun 4 10:32:49 2026 +0100
Make test more robust
---
.../catalina/valves/TestPersistentValveAsync.java | 24 ++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/test/org/apache/catalina/valves/TestPersistentValveAsync.java
b/test/org/apache/catalina/valves/TestPersistentValveAsync.java
index b852917857..4264ea90f1 100644
--- a/test/org/apache/catalina/valves/TestPersistentValveAsync.java
+++ b/test/org/apache/catalina/valves/TestPersistentValveAsync.java
@@ -218,7 +218,21 @@ public class TestPersistentValveAsync extends
TomcatBaseTest {
asyncRequest.await();
asyncRequest.assertResponse(expectedStatus, expectedResponseBody);
- assertSessionRequestSucceeds(requestHeaders);
+
+ /*
+ * The semaphore will not be released until after
AsyncListener.onComplete() has been called which will occur
+ * after the error response has been sent to the client. On some CI
systems the follow-up request occurs before
+ * the listener has completed so allow up to two seconds for the
listener to complete.
+ */
+ int count = 0;
+ int status = makeSessionRequest();
+ while (status != HttpServletResponse.SC_OK && count < 20) {
+ Thread.sleep(100);
+ count++;
+ status = makeSessionRequest();
+ }
+
+ Assert.assertEquals(HttpServletResponse.SC_OK, status);
}
@@ -229,11 +243,9 @@ public class TestPersistentValveAsync extends
TomcatBaseTest {
}
- private void assertSessionRequestSucceeds(Map<String,List<String>>
requestHeaders) throws Exception {
- ByteChunk success = new ByteChunk();
- int status = getUrl("http://localhost:" + getPort() + "/session",
success, requestHeaders, null);
- Assert.assertEquals(HttpServletResponse.SC_OK, status);
- Assert.assertFalse(success.isNull());
+ private int makeSessionRequest() throws Exception {
+ ByteChunk body = new ByteChunk();
+ return getUrl("http://localhost:" + getPort() + "/session", body,
false);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]