You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2020/10/19 15:38:54 UTC

[qpid-dispatch] branch master updated: DISPATCH-1797: Retry getting links to make sure router has enough time to create the links. This closes #883.

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

gmurthy 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 89e35fd  DISPATCH-1797: Retry getting links to make sure router has enough time to create the links. This closes #883.
89e35fd is described below

commit 89e35fd61511d317bcc28294371443642acf46f2
Author: Ganesh Murthy <gm...@apache.org>
AuthorDate: Thu Oct 15 14:56:11 2020 -0400

    DISPATCH-1797: Retry getting links to make sure router has enough time to create the links. This closes #883.
---
 tests/system_tests_qdmanage.py | 47 ++++++++++++++++++++++++++++--------------
 1 file changed, 32 insertions(+), 15 deletions(-)

diff --git a/tests/system_tests_qdmanage.py b/tests/system_tests_qdmanage.py
index efd102f..8be9399 100644
--- a/tests/system_tests_qdmanage.py
+++ b/tests/system_tests_qdmanage.py
@@ -25,8 +25,9 @@ from __future__ import print_function
 import json
 import os
 import sys
+from time import sleep
 
-from system_test import TestCase, Process, Qdrouterd, main_module, TIMEOUT, DIR
+from system_test import Logger, TestCase, Process, Qdrouterd, main_module, TIMEOUT, DIR
 from system_test import unittest
 from subprocess import PIPE, STDOUT
 from qpid_dispatch_internal.compat import dictify
@@ -523,8 +524,8 @@ class QdmanageTest(TestCase):
     def test_yy_query_many_links(self):
         # This test will fail without the fix for DISPATCH-974
         c = BlockingConnection(self.address())
+        self.logger = Logger(title="test_yy_query_many_links")
         count = 0
-        links = []
         COUNT = 5000
 
         ADDRESS_SENDER = "examples-sender"
@@ -532,14 +533,10 @@ class QdmanageTest(TestCase):
 
         # This loop creates 5000 consumer and 5000 producer links with
         # different addresses
-        while True:
-            count += 1
+        while count < COUNT:
             r = c.create_receiver(ADDRESS_RECEIVER + str(count))
-            links.append(r)
             s = c.create_sender(ADDRESS_SENDER + str(count))
-            links.append(c)
-            if count == COUNT:
-                break
+            count += 1
 
         # Try fetching all 10,000 addresses
         # This qdmanage query command would fail without the fix
@@ -564,13 +561,33 @@ class QdmanageTest(TestCase):
 
         out_links = 0
         in_links = 0
-
-        for out in outs:
-            if out.get('owningAddr'):
-                if ADDRESS_SENDER in out['owningAddr']:
-                    in_links += 1
-                if ADDRESS_RECEIVER in out['owningAddr']:
-                    out_links += 1
+        success = False
+
+        i = 0
+        while i < 3:
+            i += 1
+            for out in outs:
+                if out.get('owningAddr'):
+                    if ADDRESS_SENDER in out['owningAddr']:
+                        in_links += 1
+                    if ADDRESS_RECEIVER in out['owningAddr']:
+                        out_links += 1
+
+            # If the link count is less than COUNT, try again in 2 seconds
+            # Try after 2 more seconds for a total of 6 seconds.
+            # If the link count is still less than expected count, there
+            # is something wrong, the test has failed.
+            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
+                break
+                
+        if not success:
+            self.logger.dump()
 
         self.assertEqual(out_links, COUNT)
         self.assertEqual(in_links, COUNT)


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