You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2017/01/12 09:26:15 UTC

svn commit: r1778404 - /tomcat/trunk/test/org/apache/coyote/http2/TestAbortedUpload.java

Author: markt
Date: Thu Jan 12 09:26:15 2017
New Revision: 1778404

URL: http://svn.apache.org/viewvc?rev=1778404&view=rev
Log:
Make test more robust after observed CI failures.

Modified:
    tomcat/trunk/test/org/apache/coyote/http2/TestAbortedUpload.java

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestAbortedUpload.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestAbortedUpload.java?rev=1778404&r1=1778403&r2=1778404&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestAbortedUpload.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestAbortedUpload.java Thu Jan 12 09:26:15 2017
@@ -42,7 +42,7 @@ public class TestAbortedUpload extends H
         http2Protocol.setAllowedTrailerHeaders(TRAILER_HEADER_NAME);
 
         int bodySize = 8192;
-        int bodyCount = 10;
+        int bodyCount = 20;
 
         byte[] headersFrameHeader = new byte[9];
         ByteBuffer headersPayload = ByteBuffer.allocate(128);
@@ -64,24 +64,24 @@ public class TestAbortedUpload extends H
         // Trailers
         writeFrame(trailerFrameHeader, trailerPayload);
 
+        // The actual response depends on timing issues. Particularly how much
+        // data is transferred in StreamInputBuffer inBuffer to outBuffer on the
+        // first read.
+        while (output.getTrace().length() == 0) {
+            parser.readFrame(true);
+            if ("3-RST-[3]\n".equals(output.getTrace())) {
+                output.clearTrace();
+            }
+        }
 
-        parser.readFrame(true);
-        parser.readFrame(true);
-        parser.readFrame(true);
-        parser.readFrame(true);
-
-        // Tomcat's default Window size is 8*8k (StreamInputBuffer.inBuffer)
-        // This test sends 10*8k
-        // 9th and 10th data frames trigger a RST for a flow control error
-        // Test reads input stream which copies up to 8k into
-        // StreamInputBuffer.outBuffer
-        // That leaves 8k free in inBuffer buffer which triggers a Window Update
-        Assert.assertEquals(
-                "3-RST-[3]\n" +
-                "3-RST-[3]\n" +
-                "0-WindowSize-[8192]\n" +
-                "3-WindowSize-[8192]\n",
-                output.getTrace());
+        if (output.getTrace().startsWith("0-WindowSize-[")) {
+            String trace = output.getTrace();
+            int size = Integer.parseInt(trace.substring(14, trace.length() - 2));
+            output.clearTrace();
+            // Window updates always come in pairs
+            parser.readFrame(true);
+            Assert.assertEquals("3-WindowSize-[" + size + "]\n", output.getTrace());
+        }
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org