PROTON-1049: disable reconnect and handle connection error
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/c6439c74 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/c6439c74 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/c6439c74 Branch: refs/heads/go1 Commit: c6439c749b8fe51349e352f45f30acd9381be9cc Parents: ff13d76 Author: Gordon Sim <[email protected]> Authored: Wed Dec 16 14:08:08 2015 +0000 Committer: Gordon Sim <[email protected]> Committed: Wed Dec 16 14:08:08 2015 +0000 ---------------------------------------------------------------------- tests/python/proton_tests/reactor.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c6439c74/tests/python/proton_tests/reactor.py ---------------------------------------------------------------------- diff --git a/tests/python/proton_tests/reactor.py b/tests/python/proton_tests/reactor.py index beff329..c7d6dd8 100644 --- a/tests/python/proton_tests/reactor.py +++ b/tests/python/proton_tests/reactor.py @@ -464,6 +464,7 @@ class AuthenticationTestHandler(MessagingHandler): super(AuthenticationTestHandler, self).__init__() port = free_tcp_port() self.url = "localhost:%i" % port + self.verified = False def on_start(self, event): self.listener = event.container.listen(self.url) @@ -473,11 +474,16 @@ class AuthenticationTestHandler(MessagingHandler): def on_connection_opening(self, event): assert event.connection.transport.user == "user@proton" + self.verified = True def on_connection_closed(self, event): event.connection.close() self.listener.close() + def on_connection_error(self, event): + event.connection.close() + self.listener.close() + class ContainerTest(Test): """Test container subclass of reactor.""" @@ -511,8 +517,9 @@ class ContainerTest(Test): ensureCanTestExtendedSASL() test_handler = AuthenticationTestHandler() container = Container(test_handler) - container.connect("%s:password@%s" % ("user%40proton", test_handler.url)) + container.connect("%s:password@%s" % ("user%40proton", test_handler.url), reconnect=False) container.run() + assert test_handler.verified def test_authentication_via_container_attributes(self): ensureCanTestExtendedSASL() @@ -520,12 +527,14 @@ class ContainerTest(Test): container = Container(test_handler) container.user = "user@proton" container.password = "password" - container.connect(test_handler.url) + container.connect(test_handler.url, reconnect=False) container.run() + assert test_handler.verified def test_authentication_via_kwargs(self): ensureCanTestExtendedSASL() test_handler = AuthenticationTestHandler() container = Container(test_handler) - container.connect(test_handler.url, user="user@proton", password="password") + container.connect(test_handler.url, user="user@proton", password="password", reconnect=False) container.run() + assert test_handler.verified --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
