[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #740: DISPATCH-1646 - Enabled deletion of http listener

2020-05-21 Thread GitBox


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



##
File path: tests/system_tests_http.py.in
##
@@ -266,6 +317,22 @@ class RouterTestHttp(TestCase):
 # Provide client cert
 self.assert_get_cert("https://localhost:%d; % r.ports[2])
 
+# Try a get on the HTTP listener we are going to delete
+self.assert_get_cert("https://localhost:%d; % r.ports[3])
+
+# Delete the listener with name 'delete-me'
+long_type = 'org.apache.qpid.dispatch.listener'
+mgmt = QdManager(self, address=address())
+mgmt.delete(long_type, name=name)
+sleep(5)

Review comment:
   ditto here as well





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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



[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #740: DISPATCH-1646 - Enabled deletion of http listener

2020-05-21 Thread GitBox


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



##
File path: tests/system_tests_http.py.in
##
@@ -97,27 +101,63 @@ class RouterTestHttp(TestCase):
 
 def test_http_listener_delete(self):
 name = 'delete_listener'
+name_1 = 'delete_listener_1'
 normal_listen_port = self.get_port()
-http_delete_listen_port = self.get_port()
+#
+# Open listeners on two HTTP enabled ports. Delete one of the
+# HTTP listeners and make sure that it is really gone and also
+# make sure that the other HTTP listener is still working.
+#
+http_delete_listen_port_1 = self.get_port()
+http_delete_listen_port_2 = self.get_port()
 config = Qdrouterd.Config([
 ('router', {'mode': 'standalone', 'id': 'A'}),
-('listener', {'port': normal_listen_port, 'maxFrameSize': '2048', 
'stripAnnotations': 'no'}),
-('listener', {'name': name, 'port': http_delete_listen_port, 
'http': True})])
+('listener', {'port': normal_listen_port}),
+('listener', {'httpRootDir': os.path.dirname(__file__), 'name': 
name, 'port': http_delete_listen_port_1, 'http': True}),
+('listener', {'httpRootDir': os.path.dirname(__file__), 'name': 
name_1, 'port': http_delete_listen_port_2, 'http': True})])
 router = self.qdrouterd(name="expect_fail_1", config=config, wait=True)
-exception_occurred = False
 
 def address():
 return router.addresses[0]
 
+# Perform a GET request on the http_delete_listen_port_1 just to make
+# sure that it is up and running.
+url_1 = "%s/system_tests_http.txt" % "http://localhost:%d; % 
http_delete_listen_port_1
+out = self.get(url_1, use_ca=False)
+
+# Perform a GET request on the http_delete_listen_port_2 just to make
+# sure that it is up and running.
+url_2 = "%s/system_tests_http.txt" % "http://localhost:%d; % 
http_delete_listen_port_2
+out = self.get(url_2, use_ca=False)
+
+# Now both http_delete_listen_port_1 and http_delete_listen_port_2
+# are working.
+
+# Delete the listener on port http_delete_listen_port_1
 long_type = 'org.apache.qpid.dispatch.listener'
-delete_command = 'DELETE --type=' + long_type + ' --name=' + name
+mgmt = QdManager(self, address=address())
+mgmt.delete(long_type, name=name)
+
+# Wait for 5 seconds for the router to delete the listener
+# This is required in slower systems running this test.
+# Once again try to perform a GET request. Now since the listener
+# is gone, the GET will fail.
+sleep(5)

Review comment:
   Rather than a hard timeout which may not be enuff time for some slow ass 
systems, why not use a loop around self.get()  until either http listener goes 
away (success) or TIMEOUT seconds has been hit (failure)?   In fact the utility 
function 
[retry](https://github.com/apache/qpid-dispatch/blob/master/tests/system_test.py#L131)
 in system_test.py will do that for you - you just need to pass it a function 
that returns False until self.get() raises an exception.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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