This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit b2f49688e2bc1b14abffaba5b8e4ae94fbf8da1d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Mar 24 13:44:28 2021 +0000

    Enable debug logging for test failing intermittently in CI
---
 .../apache/coyote/http2/TestHttp2Section_5_1.java  | 95 ++++++++++++----------
 1 file changed, 51 insertions(+), 44 deletions(-)

diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index e8ca217..36e71c5 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -17,6 +17,8 @@
 package org.apache.coyote.http2;
 
 import java.nio.ByteBuffer;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -324,57 +326,62 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 
     @Test
     public void testErrorOnWaitingStream01() throws Exception {
-        // http2Connect() - modified
-        enableHttp2(1);
-        configureAndStartWebApplication();
-        openClientConnection();
-        doHttpUpgrade();
-        sendClientPreface();
+        
LogManager.getLogManager().getLogger("org.apache.coyote.http2").setLevel(Level.ALL);
+        try {
+            // http2Connect() - modified
+            enableHttp2(1);
+            configureAndStartWebApplication();
+            openClientConnection();
+            doHttpUpgrade();
+            sendClientPreface();
+
+            // validateHttp2InitialResponse() - modified
+            parser.readFrame(true);
+            parser.readFrame(true);
+            parser.readFrame(true);
+            parser.readFrame(true);
+            parser.readFrame(true);
 
-        // validateHttp2InitialResponse() - modified
-        parser.readFrame(true);
-        parser.readFrame(true);
-        parser.readFrame(true);
-        parser.readFrame(true);
-        parser.readFrame(true);
+            Assert.assertEquals("0-Settings-[3]-[1]\n" +
+                    "0-Settings-End\n" +
+                    "0-Settings-Ack\n" +
+                    "0-Ping-[0,0,0,0,0,0,0,1]\n" +
+                    getSimpleResponseTrace(1)
+                    , output.getTrace());
+            output.clearTrace();
+
+            sendLargeGetRequest(3);
+
+            sendSimpleGetRequest(5);
+
+            // Default connection window size is 64k-1.
+            // Initial request will have used 8k leaving 56k-1.
+            // Stream window will be 64k-1.
+            // Expecting
+            // 1 * headers
+            // 56k-1 of body (7 * ~8k)
+            // 1 * error (could be in any order)
+            for (int i = 0; i < 8; i++) {
+                parser.readFrame(true);
+            }
+            parser.readFrame(true);
 
-        Assert.assertEquals("0-Settings-[3]-[1]\n" +
-                "0-Settings-End\n" +
-                "0-Settings-Ack\n" +
-                "0-Ping-[0,0,0,0,0,0,0,1]\n" +
-                getSimpleResponseTrace(1)
-                , output.getTrace());
-        output.clearTrace();
+            Assert.assertTrue(output.getTrace(),
+                    output.getTrace().contains("5-RST-[" + 
Http2Error.REFUSED_STREAM.getCode() + "]"));
+            output.clearTrace();
 
-        sendLargeGetRequest(3);
+            // Connection window is zero.
+            // Stream window is 8k
 
-        sendSimpleGetRequest(5);
+            // Expand the stream window too much to trigger an error
+            // Allow for the 8k still in the stream window
+            sendWindowUpdate(3, (1 << 31) - 1);
 
-        // Default connection window size is 64k-1.
-        // Initial request will have used 8k leaving 56k-1.
-        // Stream window will be 64k-1.
-        // Expecting
-        // 1 * headers
-        // 56k-1 of body (7 * ~8k)
-        // 1 * error (could be in any order)
-        for (int i = 0; i < 8; i++) {
             parser.readFrame(true);
+            Assert.assertEquals("3-RST-[" + 
Http2Error.FLOW_CONTROL_ERROR.getCode() + "]\n", output.getTrace());
+        } finally {
+            
LogManager.getLogManager().getLogger("org.apache.coyote.http2").setLevel(Level.INFO);
         }
-        parser.readFrame(true);
-
-        Assert.assertTrue(output.getTrace(),
-                output.getTrace().contains("5-RST-[" + 
Http2Error.REFUSED_STREAM.getCode() + "]"));
-        output.clearTrace();
-
-        // Connection window is zero.
-        // Stream window is 8k
-
-        // Expand the stream window too much to trigger an error
-        // Allow for the 8k still in the stream window
-        sendWindowUpdate(3, (1 << 31) - 1);
-
-        parser.readFrame(true);
-        Assert.assertEquals("3-RST-[" + 
Http2Error.FLOW_CONTROL_ERROR.getCode() + "]\n", output.getTrace());
     }
 
 

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

Reply via email to