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

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

commit 12abc9f0d546d23b1a6275ebb81c62fccdd16694
Author: Ganesh Murthy <gmur...@apache.org>
AuthorDate: Thu Jun 10 10:22:21 2021 -0400

    DISPATCH-1797: Added a retry to qdmanage to make sure we give enough time 
for addresses to be added to the router address table. This closes #1255
    
    (cherry picked from commit bbed4647dda6b1ce8ed332d5a831c73d79055466)
---
 tests/system_tests_qdmanage.py | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/tests/system_tests_qdmanage.py b/tests/system_tests_qdmanage.py
index 5bc7ac2..81c7aa2 100644
--- a/tests/system_tests_qdmanage.py
+++ b/tests/system_tests_qdmanage.py
@@ -543,30 +543,29 @@ class QdmanageTest(TestCase):
         # This qdmanage query command would fail without the fix
         # for DISPATCH-974
         query_command = 'QUERY --type=org.apache.qpid.dispatch.router.address'
-        outs = json.loads(self.run_qdmanage(query_command))
-
-        sender_addresses = 0
-        receiver_addresses = 0
-
-        for out in outs:
-            if ADDRESS_SENDER in out['name']:
-                sender_addresses += 1
-            if ADDRESS_RECEIVER in out['name']:
-                receiver_addresses += 1
+        for i in range(3):
+            sender_addresses = 0
+            receiver_addresses = 0
+            outs = json.loads(self.run_qdmanage(query_command))
+            for out in outs:
+                if ADDRESS_SENDER in out['name']:
+                    sender_addresses += 1
+                if ADDRESS_RECEIVER in out['name']:
+                    receiver_addresses += 1
+            if sender_addresses < COUNT or receiver_addresses < COUNT:
+                sleep(2)
+            else:
+                break
 
         self.assertEqual(sender_addresses, COUNT)
         self.assertEqual(receiver_addresses, COUNT)
 
         query_command = 'QUERY --type=link'
-        outs = json.loads(self.run_qdmanage(query_command))
-
-        out_links = 0
-        in_links = 0
         success = False
-
-        i = 0
-        while i < 3:
-            i += 1
+        for i in range(3):
+            out_links = 0
+            in_links = 0
+            outs = json.loads(self.run_qdmanage(query_command))
             for out in outs:
                 if out.get('owningAddr'):
                     if ADDRESS_SENDER in out['owningAddr']:
@@ -581,7 +580,6 @@ class QdmanageTest(TestCase):
             if out_links < COUNT or in_links < COUNT:
                 self.logger.log("out_links=%s, in_links=%s" % (str(out_links), 
str(in_links)))
                 sleep(2)
-                outs = json.loads(self.run_qdmanage(query_command))
             else:
                 self.logger.log("Test success!")
                 success = True

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

Reply via email to