kgiusti commented on a change in pull request #1301:
URL: https://github.com/apache/qpid-dispatch/pull/1301#discussion_r675790413



##########
File path: tests/system_tests_http2.py
##########
@@ -728,3 +741,126 @@ def test_goaway(self):
         address = self.router_qdra.http_addresses[0] + "/goaway_test_1"
         out = self.run_curl(address, args=["-i"])
         self.assertIn("HTTP/2 503", out)
+
+
+class Http2Q2OneRouterTest(Http2TestBase):
+    @classmethod
+    def setUpClass(cls):
+        super(Http2Q2OneRouterTest, cls).setUpClass()
+        if skip_h2_test():
+            return
+        cls.http2_server_name = "http2_slow_q2_server"
+        os.environ['SERVER_LISTEN_PORT'] = str(cls.tester.get_port())
+        cls.http2_server = cls.tester.http2server(name=cls.http2_server_name,
+                                                  
listen_port=int(os.getenv('SERVER_LISTEN_PORT')),
+                                                  py_string='python3',
+                                                  
server_file="http2_slow_q2_server.py")
+        name = "http2-test-router"
+        cls.connector_name = 'connectorToServer'
+        cls.connector_props = {
+            'port': os.getenv('SERVER_LISTEN_PORT'),
+            'address': 'examples',
+            'host': '127.0.0.1',
+            'protocolVersion': 'HTTP2',
+            'name': cls.connector_name
+        }
+        config = Qdrouterd.Config([
+            ('router', {'mode': 'standalone', 'id': 'QDR'}),
+            ('listener', {'port': cls.tester.get_port(), 'role': 'normal', 
'host': '0.0.0.0'}),
+
+            ('httpListener', {'port': cls.tester.get_port(), 'address': 
'examples',
+                              'host': '127.0.0.1', 'protocolVersion': 
'HTTP2'}),
+            ('httpConnector', cls.connector_props)
+        ])
+        cls.router_qdra = cls.tester.qdrouterd(name, config, wait=True)
+
+    @unittest.skipIf(skip_h2_test(),
+                     "Python 3.7 or greater, hyper-h2 and curl needed to run 
hyperhttp2 tests")
+    def test_q2_block_unblock(self):
+        # curl  -X POST -H "Content-Type: multipart/form-data"  -F 
"data=@/home/gmurthy/opensource/test.jpg"
+        # http://127.0.0.1:9000/upload --http2-prior-knowledge
+        address = self.router_qdra.http_addresses[0] + "/upload"
+        out = self.run_curl(address, args=['-X', 'POST', '-H', 'Content-Type: 
multipart/form-data',
+                                           '-F', 'data=@' + 
image_file('test.jpg')])
+        self.assertIn('Success', out)
+        num_blocked = 0
+        num_unblocked = 0
+        blocked = "blocked"
+        unblocked = "unblocked"
+        with open(self.router_qdra.logfile_path, 'r') as router_log:
+            log_lines = router_log.read().split("\n")
+            for log_line in log_lines:
+                if unblocked in log_line:
+                    num_unblocked += 1
+                elif blocked in log_line:
+                    num_blocked += 1
+
+        self.assertGreater(num_blocked, 0)
+        self.assertGreater(num_unblocked, 0)

Review comment:
       Understood




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to