Repository: qpid-proton Updated Branches: refs/heads/master d564ddcfb -> 425ac5e62
NO-JIRA: Replace 0.0.0.0 with 127.0.0.1 connecting to a host in tests. In some circumstances using 0.0.0.0 to connect fails. This has been observed when: running the jython messenger tests, on fedroa 20, with an OpenVpn connection running. In messenger.py, 0.0.0.0 has been replaced with 127.0.0.1 for connecting only, listening to ~0.0.0.0 works fine and is unchanged. The man page ip(7) suggests that 0.0.0.0 should only be used for bind: There are several special addresses: INADDR_LOOPBACK (127.0.0.1) always refers to the local host via the loopback device; INADDR_ANY (0.0.0.0) means any address for binding; INADDR_BROADCAST (255.255.255.255) means any host and has the same effect on bind as INADDR_ANY for historical reasons. So we may need to replace 0.0.0.0 in other places, e.g. as default host value for the Url class. This is not yet done pending further discussion. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/425ac5e6 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/425ac5e6 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/425ac5e6 Branch: refs/heads/master Commit: 425ac5e628e697b69454be50958953e347907f2c Parents: d564ddc Author: Alan Conway <acon...@redhat.com> Authored: Tue Jan 27 14:41:10 2015 -0500 Committer: Alan Conway <acon...@redhat.com> Committed: Tue Jan 27 14:41:27 2015 -0500 ---------------------------------------------------------------------- tests/python/proton_tests/messenger.py | 46 ++++++++++++++--------------- tests/python/proton_tests/utils.py | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/425ac5e6/tests/python/proton_tests/messenger.py ---------------------------------------------------------------------- diff --git a/tests/python/proton_tests/messenger.py b/tests/python/proton_tests/messenger.py index 16e605d..ba8686f 100644 --- a/tests/python/proton_tests/messenger.py +++ b/tests/python/proton_tests/messenger.py @@ -128,9 +128,9 @@ class MessengerTest(Test): self.start() msg = Message() if address_size: - msg.address="amqp://0.0.0.0:12345/%s" % ("x"*address_size) + msg.address="amqp://127.0.0.1:12345/%s" % ("x"*address_size) else: - msg.address="amqp://0.0.0.0:12345" + msg.address="amqp://127.0.0.1:12345" msg.reply_to = "~" msg.subject="Hello World!" body = "First the world, then the galaxy!" @@ -188,7 +188,7 @@ class MessengerTest(Test): self.server.incoming_window = 10 self.start() msg = Message() - msg.address="amqp://0.0.0.0:12345" + msg.address="amqp://127.0.0.1:12345" msg.subject="Hello World!" trackers = [] @@ -231,7 +231,7 @@ class MessengerTest(Test): self.server.incoming_window = 10 self.start() msg = Message() - msg.address="amqp://0.0.0.0:12345" + msg.address="amqp://127.0.0.1:12345" msg.subject="Hello World!" self.client.outgoing_window = 10 @@ -274,7 +274,7 @@ class MessengerTest(Test): self.server.outgoing_window = 10 self.start() msg = Message() - msg.address="amqp://0.0.0.0:12345" + msg.address="amqp://127.0.0.1:12345" msg.reply_to = "~" msg.subject="Hello World!" @@ -308,7 +308,7 @@ class MessengerTest(Test): self.start() msg = Message() - msg.address = "amqp://0.0.0.0:12345" + msg.address = "amqp://127.0.0.1:12345" msg.reply_to = "~" msg.subject = "Hello World!" @@ -347,7 +347,7 @@ class MessengerTest(Test): count = 100 for i in range(count): msg = Message() - msg.address="amqp://0.0.0.0:12345" + msg.address="amqp://127.0.0.1:12345" msg.subject="Hello World!" msg.body = "First the world, then the galaxy!" t = self.client.put(msg) @@ -368,7 +368,7 @@ class MessengerTest(Test): def test_proton222(self): self.start() msg = Message() - msg.address="amqp://0.0.0.0:12345" + msg.address="amqp://127.0.0.1:12345" msg.subject="Hello World!" msg.body = "First the world, then the galaxy!" assert self.server_received == 0 @@ -389,7 +389,7 @@ class MessengerTest(Test): self.start() msg = Message() - msg.address="amqp://0.0.0.0:12345/XXX" + msg.address="amqp://127.0.0.1:12345/XXX" msg.reply_to = "~" msg.subject="Hello World!" body = "First the world, then the galaxy!" @@ -407,7 +407,7 @@ class MessengerTest(Test): assert rbod == body, (rbod, body) msg = Message() - msg.address="amqp://0.0.0.0:12345/YYY" + msg.address="amqp://127.0.0.1:12345/YYY" msg.reply_to = "~" msg.subject="Hello World!" body = "First the world, then the galaxy!" @@ -431,7 +431,7 @@ class MessengerTest(Test): self.start() msg = Message() - msg.address="amqp://0.0.0.0:12345" + msg.address="amqp://127.0.0.1:12345" msg.body = "X" * 1024 for x in range( 100 ): @@ -453,8 +453,8 @@ class MessengerTest(Test): domain = "amqps" self.server.subscribe(domain + "://~0.0.0.0:12346") self.start() - self.client.route("route1", "amqp://0.0.0.0:12345") - self.client.route("route2", domain + "://0.0.0.0:12346") + self.client.route("route1", "amqp://127.0.0.1:12345") + self.client.route("route2", domain + "://127.0.0.1:12346") msg = Message() msg.address = "route1" @@ -478,7 +478,7 @@ class MessengerTest(Test): def testDefaultRoute(self): self.start() - self.client.route("*", "amqp://0.0.0.0:12345") + self.client.route("*", "amqp://127.0.0.1:12345") msg = Message() msg.address = "asdf" @@ -494,7 +494,7 @@ class MessengerTest(Test): def testDefaultRouteSubstitution(self): self.start() - self.client.route("*", "amqp://0.0.0.0:12345/$1") + self.client.route("*", "amqp://127.0.0.1:12345/$1") msg = Message() msg.address = "asdf" @@ -514,8 +514,8 @@ class MessengerTest(Test): self.client.subscribe("in") msg = Message() - msg.address = "amqp://0.0.0.0:12345" - msg.reply_to = "amqp://0.0.0.0:12346" + msg.address = "amqp://127.0.0.1:12345" + msg.reply_to = "amqp://127.0.0.1:12346" msg.body = "test" self.client.put(msg) @@ -533,7 +533,7 @@ class MessengerTest(Test): def _testRewrite(self, original, rewritten): self.start() self.process_incoming = self.echo_address - self.client.route("*", "amqp://0.0.0.0:12345") + self.client.route("*", "amqp://127.0.0.1:12345") msg = Message() msg.address = original @@ -653,7 +653,7 @@ class MessengerTest(Test): # put one message out on "Link1" - since there are no other links, it # should get all the credit (10 after sending) msg = Message() - msg.address="amqp://0.0.0.0:12345/Link1" + msg.address="amqp://127.0.0.1:12345/Link1" msg.subject="Hello World!" body = "First the world, then the galaxy!" msg.body = body @@ -665,7 +665,7 @@ class MessengerTest(Test): # Now attempt to exhaust credit using a different link for i in range(10): - msg.address="amqp://0.0.0.0:12345/Link2" + msg.address="amqp://127.0.0.1:12345/Link2" self.client.put(msg) self.client.send() @@ -681,7 +681,7 @@ class MessengerTest(Test): # now attempt to send one more. There isn't enough credit, so it should # not be sent self.client.timeout = 1 - msg.address="amqp://0.0.0.0:12345/Link2" + msg.address="amqp://127.0.0.1:12345/Link2" self.client.put(msg) try: self.client.send() @@ -704,7 +704,7 @@ class NBMessengerTest(common.Test): self.server.start() self.client.start() self.client2.start() - self.address = "amqp://0.0.0.0:12345" + self.address = "amqp://127.0.0.1:12345" self.server.subscribe("amqp://~0.0.0.0:12345") def _pump(self, timeout, work_triggers_exit): @@ -996,7 +996,7 @@ class SelectableMessengerTest(common.Test): msnd = Messenger() msnd.passive = True m = Message() - m.address = "amqp://0.0.0.0:1234" + m.address = "amqp://127.0.0.1:1234" for i in range(count): m.body = u"Hello World! %s" % i http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/425ac5e6/tests/python/proton_tests/utils.py ---------------------------------------------------------------------- diff --git a/tests/python/proton_tests/utils.py b/tests/python/proton_tests/utils.py index 9973dd4..101cd9f 100644 --- a/tests/python/proton_tests/utils.py +++ b/tests/python/proton_tests/utils.py @@ -82,7 +82,7 @@ class SyncRequestResponseTest(Test): self.assertEquals(response.address, client.reply_to) self.assertEquals(response.body, body) - server = EchoServer(Url(host='127.0.0.1', port=free_tcp_port())) + server = EchoServer(Url(host="127.0.0.1", port=free_tcp_port())) server.start() server.wait(self.timeout) connection = BlockingConnection(server.url, timeout=self.timeout) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org