Skip to content

Commit

Permalink
increase timeouts in AsyncServletTest to make it less flaky
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
  • Loading branch information
lachlan-roberts committed Jul 14, 2023
1 parent 190af29 commit 887528e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
));
Expand All @@ -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"));
Expand Down Expand Up @@ -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"));
Expand All @@ -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"));
Expand All @@ -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"));
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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"));
Expand All @@ -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"));
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"
));

Expand Down Expand Up @@ -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"));
Expand All @@ -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"));
}
Expand All @@ -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);
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -490,36 +489,34 @@ 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"));
assertContains("DISPATCHED", response);
}

@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);
Expand All @@ -528,47 +525,45 @@ 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"));
assertContains("DISPATCHED", response);
}

@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",
Expand All @@ -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",
Expand Down

0 comments on commit 887528e

Please sign in to comment.