This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push: new d0971a5 Make test more robust d0971a5 is described below commit d0971a5333bdcfe452e8881626efced4e07efc5f Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Sep 15 19:09:05 2020 +0100 Make test more robust --- .../apache/coyote/http2/TestCancelledUpload.java | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/test/org/apache/coyote/http2/TestCancelledUpload.java b/test/org/apache/coyote/http2/TestCancelledUpload.java index 5c85b65..ebaaec0 100644 --- a/test/org/apache/coyote/http2/TestCancelledUpload.java +++ b/test/org/apache/coyote/http2/TestCancelledUpload.java @@ -75,7 +75,7 @@ public class TestCancelledUpload extends Http2TestBase { parser.readFrame(true); // If reset is first frame received end test here - if (output.getTrace().startsWith("3-RST-[3]\n")) { + if (checkReset()) { return; } @@ -86,7 +86,7 @@ public class TestCancelledUpload extends Http2TestBase { int size = Integer.parseInt(trace.substring(14, trace.length() - 2)); output.clearTrace(); parser.readFrame(true); - if (output.getTrace().startsWith("3-RST-[3]\n")) { + if (checkReset()) { return; } Assert.assertEquals("3-WindowSize-[" + size + "]\n", output.getTrace()); @@ -95,7 +95,7 @@ public class TestCancelledUpload extends Http2TestBase { } // Check for reset and exit if found - if (output.getTrace().startsWith("3-RST-[3]\n")) { + if (checkReset()) { return; } @@ -110,7 +110,7 @@ public class TestCancelledUpload extends Http2TestBase { parser.readFrame(true); // Check for reset and exit if found - if (output.getTrace().startsWith("3-RST-[3]\n")) { + if (checkReset()) { return; } @@ -130,7 +130,7 @@ public class TestCancelledUpload extends Http2TestBase { int size = Integer.parseInt(trace.substring(14, trace.length() - 2)); output.clearTrace(); parser.readFrame(true); - if (output.getTrace().startsWith("3-RST-[3]\n")) { + if (checkReset()) { return; } Assert.assertEquals("3-WindowSize-[" + size + "]\n", output.getTrace()); @@ -139,12 +139,30 @@ public class TestCancelledUpload extends Http2TestBase { } // This should be the reset + checkReset(); Assert.assertEquals("3-RST-[3]\n", output.getTrace()); // If there are any more frames after this, ignore them } + /* + * Depending on timing, several resets may be sent. + */ + private boolean checkReset() throws IOException, Http2Exception { + while (true) { + if (output.getTrace().startsWith("3-RST-[3]\n")) { + return true; + } else if (output.getTrace().startsWith("3-RST-[")) { + output.clearTrace(); + parser.readFrame(true); + } else { + return false; + } + } + } + + @Override protected void configureAndStartWebApplication() throws LifecycleException { Tomcat tomcat = getTomcatInstance(); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org