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/09/27 11:14:24 UTC

svn commit: r1809830 - in /tomcat/trunk/test/org/apache/coyote/http2: Http2TestBase.java TestHttp2Limits.java TestHttp2Section_6_1.java

Author: markt
Date: Wed Sep 27 11:14:24 2017
New Revision: 1809830

URL: http://svn.apache.org/viewvc?rev=1809830&view=rev
Log:
Handle possible cause of false test failure
Use utility method to reduce code duplication

Modified:
    tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
    tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java
    tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_1.java

Modified: tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java?rev=1809830&r1=1809829&r2=1809830&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java Wed Sep 27 11:14:24 2017
@@ -812,6 +812,14 @@ public abstract class Http2TestBase exte
     }
 
 
+    protected void skipWindowSizeFrames() throws Http2Exception, IOException {
+        do {
+            output.clearTrace();
+            parser.readFrame(true);
+        } while (output.getTrace().contains("WindowSize"));
+    }
+
+
     void handleGoAwayResponse(int lastStream, Http2Error expectedError)
             throws Http2Exception, IOException {
         try {

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java?rev=1809830&r1=1809829&r2=1809830&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java Wed Sep 27 11:14:24 2017
@@ -482,18 +482,15 @@ public class TestHttp2Limits extends Htt
             break;
         }
         case STREAM_RESET: {
-            parser.readFrame(true);
+            // NIO2 can sometimes send window updates depending timing
+            skipWindowSizeFrames();
+
             Assert.assertEquals("3-RST-[11]\n", output.getTrace());
             break;
         }
         case CONNECTION_RESET: {
-            // Connection reset
-            do {
-                // NIO2 can sometimes send window updates depending on the
-                // timing of the connection close
-                output.clearTrace();
-                parser.readFrame(true);
-            } while (output.getTrace().contains("WindowSize"));
+            // NIO2 can sometimes send window updates depending timing
+            skipWindowSizeFrames();
 
             // Connection ID will vary so use a pattern
             Assert.assertThat(output.getTrace(), RegexMatcher.matchesRegex(

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_1.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_1.java?rev=1809830&r1=1809829&r2=1809830&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_1.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_1.java Wed Sep 27 11:14:24 2017
@@ -83,12 +83,9 @@ public class TestHttp2Section_6_1 extend
         padding[4] = 0x01;
 
         sendSimplePostRequest(3, padding);
-        parser.readFrame(true);
+
         // May see Window updates depending on timing
-        while (output.getTrace().contains("WindowSize")) {
-            output.clearTrace();
-            parser.readFrame(true);
-        }
+        skipWindowSizeFrames();
 
         String trace = output.getTrace();
         Assert.assertTrue(trace, trace.startsWith("0-Goaway-[3]-[1]-["));



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