You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kg...@apache.org on 2018/12/24 18:55:06 UTC

[qpid-dispatch] branch master updated: NO-JIRA: fix a race in the address lookup test

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

kgiusti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/master by this push:
     new efc59ca  NO-JIRA: fix a race in the address lookup test
efc59ca is described below

commit efc59ca723f4a77ada11e4afacb4dfefd4a50fce
Author: Kenneth Giusti <kg...@apache.org>
AuthorDate: Mon Dec 24 13:54:12 2018 -0500

    NO-JIRA: fix a race in the address lookup test
---
 tests/system_test.py                 | 7 +++++--
 tests/system_tests_address_lookup.py | 5 +++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/system_test.py b/tests/system_test.py
index bec6b7f..c142ebb 100755
--- a/tests/system_test.py
+++ b/tests/system_test.py
@@ -437,12 +437,14 @@ class Qdrouterd(Process):
         except:
             return False
 
-    def wait_address(self, address, subscribers=0, remotes=0, containers=0, **retry_kwargs):
+    def wait_address(self, address, subscribers=0, remotes=0, containers=0,
+                     count=1, **retry_kwargs ):
         """
         Wait for an address to be visible on the router.
         @keyword subscribers: Wait till subscriberCount >= subscribers
         @keyword remotes: Wait till remoteCount >= remotes
         @keyword containers: Wait till containerCount >= remotes
+        @keyword count: Wait until >= count matching addresses are found
         @param retry_kwargs: keyword args for L{retry}
         """
         def check():
@@ -455,7 +457,8 @@ class Qdrouterd(Process):
 
             addrs = [a for a in addrs if a['name'].endswith(address)]
 
-            return (addrs and addrs[0]['subscriberCount'] >= subscribers
+            return (len(addrs) >= count
+                    and addrs[0]['subscriberCount'] >= subscribers
                     and addrs[0]['remoteCount'] >= remotes
                     and addrs[0]['containerCount'] >= containers)
         assert retry(check, **retry_kwargs)
diff --git a/tests/system_tests_address_lookup.py b/tests/system_tests_address_lookup.py
index 3538f93..a69886c 100644
--- a/tests/system_tests_address_lookup.py
+++ b/tests/system_tests_address_lookup.py
@@ -143,8 +143,9 @@ class LinkRouteLookupTest(TestCase):
         """
 
         # fire up a fake broker attached to the router local to the edge router
+        # wait until both in and out addresses are ready
         fb = FakeBroker(self.INT_A.broker_connector, container_id='FakeBrokerA')
-        self.INT_A.wait_address("org.apache.A", containers=1)
+        self.INT_A.wait_address("org.apache.A", containers=1, count=2)
 
         # create a fake edge and lookup the target address
         bc = BlockingConnection(self.INT_A.edge_listener, timeout=TIMEOUT)
@@ -162,7 +163,7 @@ class LinkRouteLookupTest(TestCase):
 
         # now fire up a fake broker attached to the remote router
         fb = FakeBroker(self.INT_B.broker_connector, container_id='FakeBrokerB')
-        self.INT_A.wait_address("org.apache.B", remotes=1)
+        self.INT_A.wait_address("org.apache.B", remotes=1, count=2)
 
         for direction in [True, False]:
             rsp = self._check_response(srr.call(self._lookup_request("org.apache.B.foo", direction)))


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org