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 2021/01/22 15:36:20 UTC

[qpid-dispatch] branch master updated: DISPATCH-1924: set proper type for disposition state tests

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 2f9017f  DISPATCH-1924: set proper type for disposition state tests
2f9017f is described below

commit 2f9017fab26430ca2a9a77326a667607d84ecb9b
Author: Kenneth Giusti <kg...@apache.org>
AuthorDate: Thu Jan 21 11:30:15 2021 -0500

    DISPATCH-1924: set proper type for disposition state tests
    
    Ensure route tables are cleaned up between tests.
    
    This closes #994
---
 tests/system_test.py              | 18 ++++++++++++++++++
 tests/system_tests_link_routes.py |  8 +++++++-
 tests/system_tests_two_routers.py |  2 +-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/tests/system_test.py b/tests/system_test.py
index a476016..bab62c4 100755
--- a/tests/system_test.py
+++ b/tests/system_test.py
@@ -671,6 +671,24 @@ class Qdrouterd(Process):
                     and addrs[0]['containerCount'] >= containers)
         assert retry(check, **retry_kwargs)
 
+    def wait_address_unsubscribed(self, address, **retry_kwargs):
+        """
+        Block until address has no subscribers
+        """
+        a_type = 'org.apache.qpid.dispatch.router.address'
+        def check():
+            addrs = self.management.query(a_type).get_dicts()
+            rc = list(filter(lambda a: a['name'].find(address) != -1,
+                             addrs))
+            count = 0
+            for a in rc:
+                count += a['subscriberCount']
+                count += a['remoteCount']
+                count += a['containerCount']
+
+            return count == 0
+        assert retry(check, **retry_kwargs)
+
     def get_host(self, protocol_family):
         if protocol_family == 'IPv4':
             return '127.0.0.1'
diff --git a/tests/system_tests_link_routes.py b/tests/system_tests_link_routes.py
index 47dc4b5..1334618 100644
--- a/tests/system_tests_link_routes.py
+++ b/tests/system_tests_link_routes.py
@@ -2545,6 +2545,8 @@ class LinkRoute3Hop(TestCase):
         self.assertEqual(total, fake_service.in_count)
         self.assertEqual(total, fake_service.out_count)
 
+        self.QDR_C.wait_address_unsubscribed("closest/test-client")
+
     def test_02_modified_outcome(self):
         """
         Ensure all elements of a Modified disposition are passed thru the link
@@ -2572,6 +2574,7 @@ class LinkRoute3Hop(TestCase):
         sniffer = DispositionSniffer("%s/closest/test-client" %
                                      self.QDR_C.addresses[0])
         sniffer.run()
+        self.assertEqual(None, sniffer.error)
         state = sniffer.delivery.remote
         self.assertTrue(state.failed)
         self.assertTrue(state.undeliverable)
@@ -2580,6 +2583,7 @@ class LinkRoute3Hop(TestCase):
         self.assertEqual('Value', state.annotations[symbol('Key')])
 
         fake_service.join()
+        self.QDR_C.wait_address_unsubscribed("closest/test-client")
 
     def test_03_rejected_outcome(self):
         """
@@ -2593,7 +2597,7 @@ class LinkRoute3Hop(TestCase):
                 # remote endpoint
                 dlv = event.delivery
                 dlv.local.condition = Condition("condition-name",
-                                                "condition-description",
+                                                str("condition-description"),
                                                 {symbol("condition"): "info"})
                 dlv.update(Delivery.REJECTED)
                 dlv.settle()
@@ -2608,6 +2612,7 @@ class LinkRoute3Hop(TestCase):
         sniffer = DispositionSniffer("%s/closest/test-client" %
                                      self.QDR_C.addresses[0])
         sniffer.run()
+        self.assertEqual(None, sniffer.error)
         state = sniffer.delivery.remote
         self.assertTrue(state.condition is not None)
         self.assertEqual("condition-name", state.condition.name)
@@ -2617,6 +2622,7 @@ class LinkRoute3Hop(TestCase):
         self.assertEqual('info', state.condition.info[symbol("condition")])
 
         fake_service.join()
+        self.QDR_C.wait_address_unsubscribed("closest/test-client")
 
     def test_04_extension_state(self):
         """
diff --git a/tests/system_tests_two_routers.py b/tests/system_tests_two_routers.py
index ceba725..d2c90f9 100644
--- a/tests/system_tests_two_routers.py
+++ b/tests/system_tests_two_routers.py
@@ -1644,7 +1644,7 @@ class PropagatedDispositionData(PropagatedDisposition):
     """
     def set_rejected_data(self, local_state):
         local_state.condition = Condition("name",
-                                          "description",
+                                          str("description"),
                                           {symbol("info"): True})
 
     def check_rejected_data(self, remote_state):


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