From 887528e575357ba340516e28d264cb9e65748d8a Mon Sep 17 00:00:00 2001 From: Lachlan Roberts Date: Fri, 14 Jul 2023 11:27:35 +1000 Subject: [PATCH] increase timeouts in AsyncServletTest to make it less flaky Signed-off-by: Lachlan Roberts --- .../jetty/ee10/servlet/AsyncServletTest.java | 58 +++++++-------- .../jetty/ee9/servlet/AsyncServletTest.java | 70 +++++++++---------- 2 files changed, 61 insertions(+), 67 deletions(-) diff --git a/jetty-ee10/jetty-ee10-servlet/src/test/java/org/eclipse/jetty/ee10/servlet/AsyncServletTest.java b/jetty-ee10/jetty-ee10-servlet/src/test/java/org/eclipse/jetty/ee10/servlet/AsyncServletTest.java index 7324e90af492..e9bc9c384927 100644 --- a/jetty-ee10/jetty-ee10-servlet/src/test/java/org/eclipse/jetty/ee10/servlet/AsyncServletTest.java +++ b/jetty-ee10/jetty-ee10-servlet/src/test/java/org/eclipse/jetty/ee10/servlet/AsyncServletTest.java @@ -198,12 +198,12 @@ public void testAsyncNotSupportedAsync() throws Exception try (StacklessLogging ignored = new StacklessLogging(ServletChannel.class)) { _expectedCode = "500 "; - String response = process("noasync", "start=200", null); + String response = process("noasync", "start=1000", null); assertThat(response, Matchers.startsWith("HTTP/1.1 500 ")); assertThat(_history, contains( - "REQUEST /ctx/noasync/info?start=200", + "REQUEST /ctx/noasync/info?start=1000", "initial", - "ERROR /ctx/error/custom?start=200", + "ERROR /ctx/error/custom?start=1000", "wrapped REQ", "!initial" )); @@ -217,14 +217,14 @@ public void testAsyncNotSupportedAsync() throws Exception public void testStart() throws Exception { _expectedCode = "500 "; - String response = process("start=200", null); + String response = process("start=1000", null); assertThat(response, Matchers.startsWith("HTTP/1.1 500 Server Error")); assertThat(_history, contains( - "REQUEST /ctx/path/info?start=200", + "REQUEST /ctx/path/info?start=1000", "initial", "start", "onTimeout", - "ERROR /ctx/error/custom?start=200", + "ERROR /ctx/error/custom?start=1000", "wrapped REQ", "!initial", "onComplete")); @@ -290,14 +290,14 @@ public void testStartOnTimeoutComplete() throws Exception @Test public void testStartWaitDispatch() throws Exception { - String response = process("start=200&dispatch=10", null); + String response = process("start=1000&dispatch=10", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(_history, contains( - "REQUEST /ctx/path/info?start=200&dispatch=10", + "REQUEST /ctx/path/info?start=1000&dispatch=10", "initial", "start", "dispatch", - "ASYNC /ctx/path/info?start=200&dispatch=10", + "ASYNC /ctx/path/info?start=1000&dispatch=10", "wrapped REQ", "!initial", "onComplete")); @@ -307,14 +307,14 @@ public void testStartWaitDispatch() throws Exception @Test public void testStartDispatch() throws Exception { - String response = process("start=200&dispatch=0", null); + String response = process("start=1000&dispatch=0", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(_history, contains( - "REQUEST /ctx/path/info?start=200&dispatch=0", + "REQUEST /ctx/path/info?start=1000&dispatch=0", "initial", "start", "dispatch", - "ASYNC /ctx/path/info?start=200&dispatch=0", + "ASYNC /ctx/path/info?start=1000&dispatch=0", "wrapped REQ", "!initial", "onComplete")); @@ -324,14 +324,14 @@ public void testStartDispatch() throws Exception public void testStartError() throws Exception { _expectedCode = "500 "; - String response = process("start=200&throw=1", null); + String response = process("start=1000&throw=1", null); assertThat(response, startsWith("HTTP/1.1 500 Server Error")); assertThat(_history, contains( - "REQUEST /ctx/path/info?start=200&throw=1", + "REQUEST /ctx/path/info?start=1000&throw=1", "initial", "start", "onError", - "ERROR /ctx/error/custom?start=200&throw=1", + "ERROR /ctx/error/custom?start=1000&throw=1", "wrapped REQ", "!initial", "onComplete")); @@ -341,10 +341,10 @@ public void testStartError() throws Exception @Test public void testStartWaitComplete() throws Exception { - String response = process("start=200&complete=50", null); + String response = process("start=1000&complete=50", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(_history, contains( - "REQUEST /ctx/path/info?start=200&complete=50", + "REQUEST /ctx/path/info?start=1000&complete=50", "initial", "start", "complete", @@ -357,10 +357,10 @@ public void testStartWaitComplete() throws Exception @Test public void testStartComplete() throws Exception { - String response = process("start=200&complete=0", null); + String response = process("start=1000&complete=0", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(_history, contains( - "REQUEST /ctx/path/info?start=200&complete=0", + "REQUEST /ctx/path/info?start=1000&complete=0", "initial", "start", "complete", @@ -508,14 +508,14 @@ public void testStartTimeoutStart() throws Exception @Test public void testWrapStartDispatch() throws Exception { - String response = process("wrap=true&start=200&dispatch=20", null); + String response = process("wrap=true&start=1000&dispatch=20", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(_history, contains( - "REQUEST /ctx/path/info?wrap=true&start=200&dispatch=20", + "REQUEST /ctx/path/info?wrap=true&start=1000&dispatch=20", "initial", "start", "dispatch", - "ASYNC /ctx/path/info?wrap=true&start=200&dispatch=20", + "ASYNC /ctx/path/info?wrap=true&start=1000&dispatch=20", "wrapped REQ RSP", "!initial", "onComplete")); @@ -525,14 +525,14 @@ public void testWrapStartDispatch() throws Exception @Test public void testStartDispatchEncodedPath() throws Exception { - String response = process("start=200&dispatch=20&path=/p%20th3", null); + String response = process("start=1000&dispatch=20&path=/p%20th3", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(_history, contains( - "REQUEST /ctx/path/info?start=200&dispatch=20&path=/p%20th3", + "REQUEST /ctx/path/info?start=1000&dispatch=20&path=/p%20th3", "initial", "start", "dispatch", - "ASYNC /ctx/p%20th3?start=200&dispatch=20&path=/p%20th3", + "ASYNC /ctx/p%20th3?start=1000&dispatch=20&path=/p%20th3", "wrapped REQ", "!initial", "onComplete")); @@ -582,10 +582,10 @@ public void testFwdStartDispatchPath() throws Exception @Test public void testFwdWrapStartDispatch() throws Exception { - String response = process("fwd", "wrap=true&start=200&dispatch=20", null); + String response = process("fwd", "wrap=true&start=1000&dispatch=20", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(_history, contains( - "FWD REQUEST /ctx/fwd/info?wrap=true&start=200&dispatch=20", + "FWD REQUEST /ctx/fwd/info?wrap=true&start=1000&dispatch=20", "FORWARD /ctx/path1?forward=true", "wrapped REQ", "initial", @@ -601,10 +601,10 @@ public void testFwdWrapStartDispatch() throws Exception @Test public void testFwdWrapStartDispatchPath() throws Exception { - String response = process("fwd", "wrap=true&start=200&dispatch=20&path=/path2", null); + String response = process("fwd", "wrap=true&start=1000&dispatch=20&path=/path2", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(_history, contains( - "FWD REQUEST /ctx/fwd/info?wrap=true&start=200&dispatch=20&path=/path2", + "FWD REQUEST /ctx/fwd/info?wrap=true&start=1000&dispatch=20&path=/path2", "FORWARD /ctx/path1?forward=true", "wrapped REQ", "initial", diff --git a/jetty-ee9/jetty-ee9-servlet/src/test/java/org/eclipse/jetty/ee9/servlet/AsyncServletTest.java b/jetty-ee9/jetty-ee9-servlet/src/test/java/org/eclipse/jetty/ee9/servlet/AsyncServletTest.java index f96555ee654d..5b58ef05a67f 100644 --- a/jetty-ee9/jetty-ee9-servlet/src/test/java/org/eclipse/jetty/ee9/servlet/AsyncServletTest.java +++ b/jetty-ee9/jetty-ee9-servlet/src/test/java/org/eclipse/jetty/ee9/servlet/AsyncServletTest.java @@ -54,7 +54,6 @@ import org.hamcrest.Matchers; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -199,12 +198,12 @@ public void testAsyncNotSupportedAsync() throws Exception try (StacklessLogging stackless = new StacklessLogging(HttpChannel.class)) { _expectedCode = "500 "; - String response = process("noasync", "start=200", null); + String response = process("noasync", "start=1000", null); assertThat(response, Matchers.startsWith("HTTP/1.1 500 ")); assertThat(__history, contains( - "REQUEST /ctx/noasync/info?start=200", + "REQUEST /ctx/noasync/info?start=1000", "initial", - "ERROR /ctx/error/custom?start=200", + "ERROR /ctx/error/custom?start=1000", "!initial" )); @@ -288,14 +287,14 @@ public void testStartOnTimeoutComplete() throws Exception @Test public void testStartWaitDispatch() throws Exception { - String response = process("start=200&dispatch=10", null); + String response = process("start=1000&dispatch=10", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(__history, contains( - "REQUEST /ctx/path/info?start=200&dispatch=10", + "REQUEST /ctx/path/info?start=1000&dispatch=10", "initial", "start", "dispatch", - "ASYNC /ctx/path/info?start=200&dispatch=10", + "ASYNC /ctx/path/info?start=1000&dispatch=10", "!initial", "onComplete")); assertFalse(__history.contains("onTimeout")); @@ -304,14 +303,14 @@ public void testStartWaitDispatch() throws Exception @Test public void testStartDispatch() throws Exception { - String response = process("start=200&dispatch=0", null); + String response = process("start=1000&dispatch=0", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(__history, contains( - "REQUEST /ctx/path/info?start=200&dispatch=0", + "REQUEST /ctx/path/info?start=1000&dispatch=0", "initial", "start", "dispatch", - "ASYNC /ctx/path/info?start=200&dispatch=0", + "ASYNC /ctx/path/info?start=1000&dispatch=0", "!initial", "onComplete")); } @@ -320,14 +319,14 @@ public void testStartDispatch() throws Exception public void testStartError() throws Exception { _expectedCode = "500 "; - String response = process("start=200&throw=1", null); + String response = process("start=1000&throw=1", null); assertThat(response, startsWith("HTTP/1.1 500 Server Error")); assertThat(__history, contains( - "REQUEST /ctx/path/info?start=200&throw=1", + "REQUEST /ctx/path/info?start=1000&throw=1", "initial", "start", "onError", - "ERROR /ctx/error/custom?start=200&throw=1", + "ERROR /ctx/error/custom?start=1000&throw=1", "!initial", "onComplete")); assertContains("ERROR DISPATCH: /ctx/error/custom", response); @@ -336,10 +335,10 @@ public void testStartError() throws Exception @Test public void testStartWaitComplete() throws Exception { - String response = process("start=200&complete=50", null); + String response = process("start=1000&complete=50", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(__history, contains( - "REQUEST /ctx/path/info?start=200&complete=50", + "REQUEST /ctx/path/info?start=1000&complete=50", "initial", "start", "complete", @@ -352,10 +351,10 @@ public void testStartWaitComplete() throws Exception @Test public void testStartComplete() throws Exception { - String response = process("start=200&complete=0", null); + String response = process("start=1000&complete=0", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(__history, contains( - "REQUEST /ctx/path/info?start=200&complete=0", + "REQUEST /ctx/path/info?start=1000&complete=0", "initial", "start", "complete", @@ -490,18 +489,17 @@ public void testStartTimeoutStart() throws Exception assertContains("AsyncContext timeout", response); } - @Disabled // TODO @Test public void testWrapStartDispatch() throws Exception { - String response = process("wrap=true&start=200&dispatch=20", null); + String response = process("wrap=true&start=1000&dispatch=20", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(__history, contains( - "REQUEST /ctx/path/info?wrap=true&start=200&dispatch=20", + "REQUEST /ctx/path/info?wrap=true&start=1000&dispatch=20", "initial", "start", "dispatch", - "ASYNC /ctx/path/info?wrap=true&start=200&dispatch=20", + "ASYNC /ctx/path/info?wrap=true&start=1000&dispatch=20", "wrapped REQ RSP", "!initial", "onComplete")); @@ -509,17 +507,16 @@ public void testWrapStartDispatch() throws Exception } @Test - @Disabled // TODO public void testStartDispatchEncodedPath() throws Exception { - String response = process("start=200&dispatch=20&path=/p%20th3", null); + String response = process("start=1000&dispatch=20&path=/p%20th3", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(__history, contains( - "REQUEST /ctx/path/info?start=200&dispatch=20&path=/p%20th3", + "REQUEST /ctx/path/info?start=1000&dispatch=20&path=/p%20th3", "initial", "start", "dispatch", - "ASYNC /ctx/p%20th3?start=200&dispatch=20&path=/p%20th3", + "ASYNC /ctx/p%20th3?start=1000&dispatch=20&path=/p%20th3", "!initial", "onComplete")); assertContains("DISPATCHED", response); @@ -528,15 +525,15 @@ public void testStartDispatchEncodedPath() throws Exception @Test public void testFwdStartDispatch() throws Exception { - String response = process("fwd", "start=200&dispatch=20", null); + String response = process("fwd", "start=1000&dispatch=20", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(__history, contains( - "FWD REQUEST /ctx/fwd/info?start=200&dispatch=20", + "FWD REQUEST /ctx/fwd/info?start=1000&dispatch=20", "FORWARD /ctx/path1?forward=true", "initial", "start", "dispatch", - "FWD ASYNC /ctx/fwd/info?start=200&dispatch=20", + "FWD ASYNC /ctx/fwd/info?start=1000&dispatch=20", "FORWARD /ctx/path1?forward=true", "!initial", "onComplete")); @@ -544,31 +541,29 @@ public void testFwdStartDispatch() throws Exception } @Test - @Disabled // TODO public void testFwdStartDispatchPath() throws Exception { - String response = process("fwd", "start=200&dispatch=20&path=/path2", null); + String response = process("fwd", "start=1000&dispatch=20&path=/path2", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(__history, contains( - "FWD REQUEST /ctx/fwd/info?start=200&dispatch=20&path=/path2", + "FWD REQUEST /ctx/fwd/info?start=1000&dispatch=20&path=/path2", "FORWARD /ctx/path1?forward=true", "initial", "start", "dispatch", - "ASYNC /ctx/path2?start=200&dispatch=20&path=/path2", + "ASYNC /ctx/path2?start=1000&dispatch=20&path=/path2", "!initial", "onComplete")); assertContains("DISPATCHED", response); } @Test - @Disabled // TODO public void testFwdWrapStartDispatch() throws Exception { - String response = process("fwd", "wrap=true&start=200&dispatch=20", null); + String response = process("fwd", "wrap=true&start=1000&dispatch=20", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(__history, contains( - "FWD REQUEST /ctx/fwd/info?wrap=true&start=200&dispatch=20", + "FWD REQUEST /ctx/fwd/info?wrap=true&start=1000&dispatch=20", "FORWARD /ctx/path1?forward=true", "initial", "start", @@ -581,13 +576,12 @@ public void testFwdWrapStartDispatch() throws Exception } @Test - @Disabled // TODO public void testFwdWrapStartDispatchPath() throws Exception { - String response = process("fwd", "wrap=true&start=200&dispatch=20&path=/path2", null); + String response = process("fwd", "wrap=true&start=1000&dispatch=20&path=/path2", null); assertThat(response, startsWith("HTTP/1.1 200 OK")); assertThat(__history, contains( - "FWD REQUEST /ctx/fwd/info?wrap=true&start=200&dispatch=20&path=/path2", + "FWD REQUEST /ctx/fwd/info?wrap=true&start=1000&dispatch=20&path=/path2", "FORWARD /ctx/path1?forward=true", "initial", "start",