qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmur...@apache.org
Subject [qpid-dispatch] branch master updated: DISPATCH-1546: Added large message option to all tests so counts can be checked for large streaming messages. This closes #666.
Date Mon, 20 Jan 2020 19:55:46 GMT
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 344ce6e  DISPATCH-1546: Added large message option to all tests so counts can be
checked for large streaming messages. This closes #666.
344ce6e is described below

commit 344ce6e3fd9a8e2e525514483f0909e3ac7f563b
Author: Ganesh Murthy <gmurthy@apache.org>
AuthorDate: Fri Jan 17 17:57:27 2020 -0500

    DISPATCH-1546: Added large message option to all tests so counts can be checked for large
streaming messages. This closes #666.
---
 tests/system_tests_delivery_counts.py | 399 ++++++++++++++++++++++------------
 1 file changed, 255 insertions(+), 144 deletions(-)

diff --git a/tests/system_tests_delivery_counts.py b/tests/system_tests_delivery_counts.py
index 3c407b9..193b013 100644
--- a/tests/system_tests_delivery_counts.py
+++ b/tests/system_tests_delivery_counts.py
@@ -40,6 +40,11 @@ _LINK_STATISTIC_KEYS = set(['unsettledCount',
                             'deliveryCount',
                             'modifiedCount'])
 
+def get_body(n_sent, large_message=False):
+    if large_message:
+        body = {'number': n_sent, 'msg': LARGE_PAYLOAD}
+    else:
+        body = {'number': n_sent}
 
 def _link_stats_are_zero(statistics, keys):
     """
@@ -64,36 +69,44 @@ class OneRouterModifiedTest(TestCase):
 
         cls.router = cls.tester.qdrouterd(name="A", config=config, wait=True)
 
-    def test_one_router_modified_counts(self):
+    def router_modified_counts(self, large_message=False):
         address = self.router.addresses[0]
 
-        test = ModifiedDeliveriesTest(address)
-        test.run()
-
         local_node = Node.connect(address, timeout=TIMEOUT)
         outs = local_node.query(type='org.apache.qpid.dispatch.router')
-
         deliveries_modified_index = outs.attribute_names.index('modifiedDeliveries')
+        results = outs.results[0]
+        num_modified_deliveries_pre_test = results[deliveries_modified_index]
+
+        num_messages = 10
+        test = ModifiedDeliveriesTest(address, num_messages, large_message)
+        test.run()
 
+        outs = local_node.query(type='org.apache.qpid.dispatch.router')
         results = outs.results[0]
 
-        self.assertEqual(results[deliveries_modified_index], 10)
+        self.assertEqual(results[deliveries_modified_index] - num_modified_deliveries_pre_test,
num_messages)
 
         # check link statistics
         self.assertTrue(_link_stats_are_zero(test.sender_stats,
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'modifiedCount'])))
-        self.assertEqual(test.sender_stats['deliveryCount'], 10)
-        self.assertEqual(test.sender_stats['modifiedCount'], 10)
+        self.assertEqual(test.sender_stats['deliveryCount'], num_messages)
+        self.assertEqual(test.sender_stats['modifiedCount'], num_messages)
 
         # receiver just drops the link, so these are not counted as modified
         # but unsettled instead
-        self.assertEqual(test.receiver_stats['deliveryCount'], 10)
-        self.assertEqual(test.receiver_stats['unsettledCount'], 10)
+        self.assertEqual(test.receiver_stats['deliveryCount'], num_messages)
+        self.assertEqual(test.receiver_stats['unsettledCount'], num_messages)
         self.assertTrue(_link_stats_are_zero(test.receiver_stats,
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'unsettledCount'])))
 
+    def test_one_router_modified_counts(self):
+        self.router_modified_counts()
+
+    def test_one_router_large_message_modified_counts(self):
+        self.router_modified_counts(True)
 
 class OneRouterRejectedTest(TestCase):
     @classmethod
@@ -108,34 +121,43 @@ class OneRouterRejectedTest(TestCase):
 
         cls.router = cls.tester.qdrouterd(name="A", config=config, wait=True)
 
-    def test_one_router_rejected_counts(self):
+    def one_router_rejected_counts(self, large_message=False):
         address = self.router.addresses[0]
 
-        test = RejectedDeliveriesTest(address)
-        test.run()
-
         local_node = Node.connect(address, timeout=TIMEOUT)
         outs = local_node.query(type='org.apache.qpid.dispatch.router')
-
         deliveries_rejected_index = outs.attribute_names.index('rejectedDeliveries')
+        results = outs.results[0]
+        deliveries_rejected_pre_test = results[deliveries_rejected_index]
+
+        num_messages = 10
+        test = RejectedDeliveriesTest(address, num_messages, large_message)
+        test.run()
 
+        outs = local_node.query(type='org.apache.qpid.dispatch.router')
         results = outs.results[0]
 
-        self.assertEqual(results[deliveries_rejected_index], 10)
+        self.assertEqual(results[deliveries_rejected_index] - deliveries_rejected_pre_test,
num_messages)
 
         # check link statistics
-        self.assertEqual(test.sender_stats['deliveryCount'], 10)
-        self.assertEqual(test.sender_stats['rejectedCount'], 10)
+        self.assertEqual(test.sender_stats['deliveryCount'], num_messages)
+        self.assertEqual(test.sender_stats['rejectedCount'], num_messages)
         self.assertTrue(_link_stats_are_zero(test.sender_stats,
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'rejectedCount'])))
 
-        self.assertEqual(test.receiver_stats['deliveryCount'], 10)
-        self.assertEqual(test.receiver_stats['rejectedCount'], 10)
+        self.assertEqual(test.receiver_stats['deliveryCount'], num_messages)
+        self.assertEqual(test.receiver_stats['rejectedCount'], num_messages)
         self.assertTrue(_link_stats_are_zero(test.receiver_stats,
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'rejectedCount'])))
 
+    def test_one_router_rejected_counts(self):
+        self.one_router_rejected_counts()
+
+    def test_one_router_large_message_rejected_counts(self):
+        self.one_router_rejected_counts(True)
+
 
 class OneRouterReleasedDroppedPresettledTest(TestCase):
     @classmethod
@@ -151,24 +173,31 @@ class OneRouterReleasedDroppedPresettledTest(TestCase):
 
         cls.router = cls.tester.qdrouterd(name="A", config=config, wait=True)
 
-    def test_one_router_released_dropped_counts(self):
+    def one_router_released_dropped_count(self, large_message=False):
         address = self.router.addresses[0]
 
-        test = ReleasedDroppedPresettledCountTest(address)
-        test.run()
-
         local_node = Node.connect(address, timeout=TIMEOUT)
         outs = local_node.query(type='org.apache.qpid.dispatch.router')
 
         deliveries_dropped_presettled_index = outs.attribute_names.index('droppedPresettledDeliveries')
         deliveries_released_index = outs.attribute_names.index('releasedDeliveries')
         deliveries_presettled_index = outs.attribute_names.index('presettledDeliveries')
+        results = outs.results[0]
+
+        deliveries_dropped_presettled_pre_test = results[deliveries_dropped_presettled_index]
+        deliveries_released_pre_test = results[deliveries_released_index]
+        deliveries_presettled_pre_test = results[deliveries_presettled_index]
+        num_messages = 20
+        test = ReleasedDroppedPresettledCountTest(address, num_messages, large_message)
+        test.run()
+
+        outs = local_node.query(type='org.apache.qpid.dispatch.router')
 
         results = outs.results[0]
 
-        self.assertEqual(results[deliveries_dropped_presettled_index], 10)
-        self.assertEqual(results[deliveries_released_index], 10)
-        self.assertEqual(results[deliveries_presettled_index], 10)
+        self.assertEqual(results[deliveries_dropped_presettled_index] - deliveries_dropped_presettled_pre_test,
10)
+        self.assertEqual(results[deliveries_released_index] - deliveries_released_pre_test,
10)
+        self.assertEqual(results[deliveries_presettled_index] - deliveries_presettled_pre_test,
10)
 
         # check link statistics
         self.assertEqual(test.sender_stats['deliveryCount'], test.n_sent)
@@ -180,7 +209,11 @@ class OneRouterReleasedDroppedPresettledTest(TestCase):
                                                                          'releasedCount',
                                                                          'presettledCount',
                                                                          'droppedPresettledCount'])))
+    def test_one_router_released_dropped_counts(self):
+        self.one_router_released_dropped_count()
 
+    def test_one_router_large_message_released_dropped_counts(self):
+        self.one_router_released_dropped_count(True)
 
 class TwoRouterReleasedDroppedPresettledTest(TestCase):
     @classmethod
@@ -210,27 +243,31 @@ class TwoRouterReleasedDroppedPresettledTest(TestCase):
         cls.routers.append(cls.tester.qdrouterd("B", config_2, wait=True))
         cls.routers[1].wait_router_connected('A')
 
-    def test_two_router_released_dropped_counts(self):
+    def two_router_released_dropped_counts(self, large_message=False):
         address = self.routers[0].addresses[0]
 
         # Send presettled and settled messages to router 1.
         # Make sure the hello messages (which are presettled dont show up in the counts
 
-        test = ReleasedDroppedPresettledCountTest(address)
-        test.run()
-
         local_node = Node.connect(address, timeout=TIMEOUT)
         outs = local_node.query(type='org.apache.qpid.dispatch.router')
-
         deliveries_dropped_presettled_index = outs.attribute_names.index('droppedPresettledDeliveries')
         deliveries_released_index = outs.attribute_names.index('releasedDeliveries')
         deliveries_presettled_index = outs.attribute_names.index('presettledDeliveries')
+        results = outs.results[0]
+        deliveries_dropped_presettled_pre_test = results[deliveries_dropped_presettled_index]
+        deliveries_released_pre_test = results[deliveries_released_index]
+        deliveries_presettled_pre_test = results[deliveries_presettled_index]
+        num_messages = 20
+        test = ReleasedDroppedPresettledCountTest(address, num_messages, large_message)
+        test.run()
 
+        outs = local_node.query(type='org.apache.qpid.dispatch.router')
         results = outs.results[0]
 
-        self.assertEqual(results[deliveries_dropped_presettled_index], 10)
-        self.assertEqual(results[deliveries_released_index], 10)
-        self.assertEqual(results[deliveries_presettled_index], 10)
+        self.assertEqual(results[deliveries_dropped_presettled_index] - deliveries_dropped_presettled_pre_test,
10)
+        self.assertEqual(results[deliveries_released_index] - deliveries_released_pre_test,
10)
+        self.assertEqual(results[deliveries_presettled_index] - deliveries_presettled_pre_test,
10)
 
         # check link statistics
         self.assertEqual(test.sender_stats['deliveryCount'], test.n_sent)
@@ -243,6 +280,12 @@ class TwoRouterReleasedDroppedPresettledTest(TestCase):
                                                                          'presettledCount',
                                                                          'droppedPresettledCount'])))
 
+    def test_two_router_released_dropped_counts(self):
+        self.two_router_released_dropped_counts()
+
+    def test_two_router_large_message_released_dropped_counts(self):
+        self.two_router_released_dropped_counts(True)
+
 
 class AddressCheckerTimeout ( object ):
     def __init__(self, parent):
@@ -603,7 +646,7 @@ class LinkRouteIngressEgressTransitTest(TestCase):
         # bit more time for the routers to stabilize.
         sleep(2)
 
-    def test_link_route_ingress_egress_transit_counts(self):
+    def link_route_ingress_egress_transit_counts(self, large_message=False):
         address1 = self.routers[2].addresses[0]
         address2 = self.routers[2].addresses[0]
 
@@ -620,16 +663,13 @@ class LinkRouteIngressEgressTransitTest(TestCase):
         pre_egress_count = results[deliveries_egress_index]
         pre_transit_count = results[deliveries_transit_index]
 
+        num_messages = 10
         # Send and receive on the same router, router C
-        test = IngressEgressTransitLinkRouteTest(address1, address2)
+        test = IngressEgressTransitLinkRouteTest(address1, address2, num_messages, large_message=large_message)
         test.run()
         local_node = Node.connect(address1, timeout=TIMEOUT)
         outs = local_node.query(type='org.apache.qpid.dispatch.router')
 
-        deliveries_ingress_index = outs.attribute_names.index('deliveriesIngress')
-        deliveries_egress_index = outs.attribute_names.index('deliveriesEgress')
-        deliveries_transit_index = outs.attribute_names.index('deliveriesTransit')
-
         results = outs.results[0]
 
         post_ingress_count = results[deliveries_ingress_index]
@@ -658,6 +698,11 @@ class LinkRouteIngressEgressTransitTest(TestCase):
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'acceptedCount'])))
 
+    def test_link_route_ingress_egress_transit_counts(self):
+        self.link_route_ingress_egress_transit_counts()
+
+    def test_link_route_large_message_ingress_egress_transit_counts(self):
+        self.link_route_ingress_egress_transit_counts(True)
 
 class TwoRouterIngressEgressTest(TestCase):
     @classmethod
@@ -686,7 +731,7 @@ class TwoRouterIngressEgressTest(TestCase):
         cls.routers.append(cls.tester.qdrouterd("B", config_2, wait=True))
         cls.routers[1].wait_router_connected('A')
 
-    def test_two_router_ingress_egress_counts(self):
+    def two_router_ingress_egress_counts(self, large_message=False):
         in_router_addr = self.routers[0].addresses[0]
         out_router_addr = self.routers[1].addresses[0]
 
@@ -710,21 +755,19 @@ class TwoRouterIngressEgressTest(TestCase):
 
         # Now run the test.  At the end of the test each router will be queried
         # for the per-link stats
-        test = IngressEgressTwoRouterTest(in_router_addr, out_router_addr)
+        num_messages = 10
+        test = IngressEgressTwoRouterTest(in_router_addr, out_router_addr, num_messages,
large_message=large_message)
         test.run()
 
         # Gather the values for deliveries_ingress and deliveries_egress after running the
test.
         local_node = Node.connect(in_router_addr, timeout=TIMEOUT)
         outs = local_node.query(type='org.apache.qpid.dispatch.router')
-        deliveries_ingress_index = outs.attribute_names.index('deliveriesIngress')
         results = outs.results[0]
 
         post_deliveries_ingresss = results[deliveries_ingress_index]
 
         local_node = Node.connect(out_router_addr, timeout=TIMEOUT)
         outs = local_node.query(type='org.apache.qpid.dispatch.router')
-        deliveries_egress_index = outs.attribute_names.index('deliveriesEgress')
-        deliveries_accepted_index = outs.attribute_names.index('acceptedDeliveries')
         results = outs.results[0]
 
         post_deliveries_egress = results[deliveries_egress_index]
@@ -737,15 +780,15 @@ class TwoRouterIngressEgressTest(TestCase):
         self.assertEqual(post_deliveries_egress - pre_deliveries_egress, 12)
 
         # check the link statistics
-        self.assertEqual(test.sender_stats['deliveryCount'], 10)
-        self.assertEqual(test.sender_stats['acceptedCount'], 10)
+        self.assertEqual(test.sender_stats['deliveryCount'], num_messages)
+        self.assertEqual(test.sender_stats['acceptedCount'], num_messages)
         self.assertTrue(_link_stats_are_zero(test.sender_stats,
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'acceptedCount'])))
 
 
-        self.assertEqual(test.receiver_stats['deliveryCount'], 10)
-        self.assertEqual(test.receiver_stats['acceptedCount'], 10)
+        self.assertEqual(test.receiver_stats['deliveryCount'], num_messages)
+        self.assertEqual(test.receiver_stats['acceptedCount'], num_messages)
         self.assertTrue(_link_stats_are_zero(test.receiver_stats,
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'acceptedCount'])))
@@ -754,8 +797,13 @@ class TwoRouterIngressEgressTest(TestCase):
         # exact number of accepted deliveries at this point in time. But it must at least
be 10 since
         # we know for sure from the test that the 10 dispositions related to the 10 sent
messages
         # were definitely received
-        self.assertTrue(accepted_deliveries_diff >= 10)
+        self.assertTrue(accepted_deliveries_diff >= num_messages)
+
+    def test_two_router_ingress_egress_counts(self):
+        self.two_router_ingress_egress_counts()
 
+    def test_two_router_large_message_ingress_egress_counts(self):
+        self.two_router_ingress_egress_counts(True)
 
 class OneRouterIngressEgressTest(TestCase):
     @classmethod
@@ -770,38 +818,50 @@ class OneRouterIngressEgressTest(TestCase):
 
         cls.router = cls.tester.qdrouterd(name="A", config=config, wait=True)
 
-    def test_one_router_ingress_egress_counts(self):
+    def one_router_ingress_egress_counts(self, large_message=False):
         address = self.router.addresses[0]
 
-        test = IngressEgressOneRouterTest(address)
-        test.run()
-
         local_node = Node.connect(address, timeout=TIMEOUT)
         outs = local_node.query(type='org.apache.qpid.dispatch.router')
 
         deliveries_ingress_index = outs.attribute_names.index('deliveriesIngress')
         deliveries_egress_index = outs.attribute_names.index('deliveriesEgress')
+        results = outs.results[0]
+        deliveries_ingress_pre_test = results[deliveries_ingress_index]
+        deliveries_egress_pre_test = results[deliveries_egress_index]
+
+        num_messages = 10
+        test = IngressEgressOneRouterTest(address, num_messages, large_message=large_message)
+        test.run()
+
+        outs = local_node.query(type='org.apache.qpid.dispatch.router')
 
         results = outs.results[0]
 
         # 13 = ten msgs + 3 mgmt requests
-        self.assertEqual(results[deliveries_ingress_index], 13)
+        self.assertEqual(results[deliveries_ingress_index] - deliveries_ingress_pre_test,
13)
         # 12 = ten msgs + 2 mgmt requests
-        self.assertEqual(results[deliveries_egress_index], 12)
+        self.assertEqual(results[deliveries_egress_index] - deliveries_egress_pre_test, 13)
 
         # check the link statistics
-        self.assertEqual(test.sender_stats['deliveryCount'], 10)
-        self.assertEqual(test.sender_stats['acceptedCount'], 10)
+        self.assertEqual(test.sender_stats['deliveryCount'], num_messages)
+        self.assertEqual(test.sender_stats['acceptedCount'], num_messages)
         self.assertTrue(_link_stats_are_zero(test.sender_stats,
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'acceptedCount'])))
 
-        self.assertEqual(test.receiver_stats['deliveryCount'], 10)
-        self.assertEqual(test.receiver_stats['acceptedCount'], 10)
+        self.assertEqual(test.receiver_stats['deliveryCount'], num_messages)
+        self.assertEqual(test.receiver_stats['acceptedCount'], num_messages)
         self.assertTrue(_link_stats_are_zero(test.receiver_stats,
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'acceptedCount'])))
 
+    def test_one_router_ingress_egress_counts(self):
+        self.one_router_ingress_egress_counts()
+
+    def test_one_router_large_message_ingress_egress_counts(self):
+        self.one_router_ingress_egress_counts(True)
+
 
 class RouteContainerEgressCount(TestCase):
     @classmethod
@@ -829,34 +889,46 @@ class RouteContainerEgressCount(TestCase):
 
         cls.router = cls.tester.qdrouterd(name="A", config=config, wait=True)
 
-    def test_route_container_egress(self):
+    def route_container_egress(self , large_message=False):
         regular_addr = self.router.addresses[0]
         route_container_addr = self.router.addresses[1]
-        test = RouteContainerEgressTest(route_container_addr, regular_addr)
-        test.run()
-
+        num_messages = 10
         local_node = Node.connect(regular_addr, timeout=TIMEOUT)
         outs = local_node.query(type='org.apache.qpid.dispatch.router')
+        deliveries_egress_route_container_index = outs.attribute_names.index('deliveriesEgressRouteContainer')
+        results = outs.results[0]
+
+        deliveries_egress_pre_test = results[deliveries_egress_route_container_index]
 
+        test = RouteContainerEgressTest(route_container_addr, regular_addr, num_messages,
large_message=large_message)
+        test.run()
+
+        outs = local_node.query(type='org.apache.qpid.dispatch.router')
         deliveries_egress_route_container_index = outs.attribute_names.index('deliveriesEgressRouteContainer')
 
         results = outs.results[0]
         # 11 = 10 msgs + 1 mgmt msg
-        self.assertEqual(results[deliveries_egress_route_container_index], 11)
+        self.assertEqual(results[deliveries_egress_route_container_index] - deliveries_egress_pre_test,
11)
 
         # check link statistics
-        self.assertEqual(test.sender_stats['deliveryCount'], 10)
-        self.assertEqual(test.sender_stats['acceptedCount'], 10)
+        self.assertEqual(test.sender_stats['deliveryCount'], num_messages)
+        self.assertEqual(test.sender_stats['acceptedCount'], num_messages)
         self.assertTrue(_link_stats_are_zero(test.sender_stats,
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'acceptedCount'])))
 
-        self.assertEqual(test.receiver_stats['deliveryCount'], 10)
-        self.assertEqual(test.receiver_stats['acceptedCount'], 10)
+        self.assertEqual(test.receiver_stats['deliveryCount'], num_messages)
+        self.assertEqual(test.receiver_stats['acceptedCount'], num_messages)
         self.assertTrue(_link_stats_are_zero(test.receiver_stats,
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'acceptedCount'])))
 
+    def test_route_container_egress_count(self):
+        self.route_container_egress()
+
+    def test_route_container_large_message_egress_count(self):
+        self.route_container_egress(True)
+
 
 class OneRouterLinkCountersTest(TestCase):
     """
@@ -889,7 +961,8 @@ class OneRouterLinkCountersTest(TestCase):
         presettled or unsettled messages.
         """
         def __init__(self, router_addr, count=None, rx_limit=None,
-                     credit=None, presettled=False, outcome=None):
+                     credit=None, presettled=False, outcome=None,
+                     large_message=False):
             super(OneRouterLinkCountersTest.LinkCountersTest,
                   self).__init__(auto_accept=False,
                                  auto_settle=False,
@@ -910,6 +983,7 @@ class OneRouterLinkCountersTest(TestCase):
             self.conn = None
             self.sender_stats = None
             self.receiver_stats = None
+            self.large_message = large_message
 
         def timeout(self):
             self._cleanup()
@@ -953,7 +1027,10 @@ class OneRouterLinkCountersTest(TestCase):
                                                         name="Tx_Test01")
         def on_sendable(self, event):
             if self.sent < self.count:
-                dlv = self.sender.send(Message(body="Test01"))
+                if self.large_message:
+                    dlv = self.sender.send(Message(body=LARGE_PAYLOAD))
+                else:
+                    dlv = self.sender.send(Message(body="Test01"))
                 if self.presettled:
                     dlv.settle()
                 self.sent += 1
@@ -967,8 +1044,59 @@ class OneRouterLinkCountersTest(TestCase):
         def run(self):
             Container(self).run()
 
+    def verify_released(self, large_message=False):
+        """
+        Verify the link released count by releasing all received messages
+        """
+        test = self.LinkCountersTest(self.router.addresses[0],
+                                     outcome=Delivery.RELEASED,
+                                     large_message=large_message)
+        test.run()
+        self.assertEqual(test.receiver_stats['deliveryCount'], self.COUNT)
+        self.assertEqual(test.receiver_stats['releasedCount'], self.COUNT)
+        self.assertTrue(_link_stats_are_zero(test.receiver_stats,
+                                             _LINK_STATISTIC_KEYS
+                                             - set(['deliveryCount',
+                                                    'releasedCount'])))
+
+        self.assertEqual(test.sender_stats['deliveryCount'], self.COUNT)
+        self.assertEqual(test.sender_stats['releasedCount'], self.COUNT)
+        self.assertTrue(_link_stats_are_zero(test.sender_stats,
+                                             _LINK_STATISTIC_KEYS
+                                             - set(['deliveryCount',
+                                                    'releasedCount'])))
 
-    def test_01_presettled(self):
+    def verify_unsettled_count(self, large_message=False):
+        """
+        Verify the link unsettled count by granting less credit than required
+        by the sender
+        """
+        test = self.LinkCountersTest(self.router.addresses[0],
+                                     presettled=False,
+                                     count=self.COUNT,
+                                     rx_limit=self.CREDIT,
+                                     credit=self.CREDIT,
+                                     large_message=large_message)
+        test.run()
+
+        # expect the receiver to get rx_limit worth of unsettled deliveries
+        self.assertEqual(test.receiver_stats['deliveryCount'], self.CREDIT)
+        self.assertEqual(test.receiver_stats['unsettledCount'], self.CREDIT)
+        self.assertTrue(_link_stats_are_zero(test.receiver_stats,
+                                             _LINK_STATISTIC_KEYS
+                                             - set(['deliveryCount',
+                                                    'unsettledCount'])))
+
+        # expect sender only to be able to send as much as credit
+        self.assertEqual(test.sender_stats['deliveryCount'], self.CREDIT)
+        self.assertEqual(test.sender_stats['unsettledCount'], self.CREDIT)
+        self.assertTrue(_link_stats_are_zero(test.sender_stats,
+                                             _LINK_STATISTIC_KEYS
+                                             - set(['deliveryCount',
+                                                    'unsettledCount'])))
+
+
+    def verify_presettled_count(self, large_message=False):
         """
         Verify the presettled dropped count link counter by exhausting credit
         before sending is complete
@@ -978,7 +1106,8 @@ class OneRouterLinkCountersTest(TestCase):
                                      presettled=True,
                                      count=self.COUNT,
                                      rx_limit=limit,
-                                     credit=limit)
+                                     credit=limit,
+                                     large_message=large_message)
         test.run()
 
         # since these are presettled the sender should have credit
@@ -1018,56 +1147,7 @@ class OneRouterLinkCountersTest(TestCase):
                                                     'droppedPresettledCount',
                                                     'presettledCount'])))
 
-    def test_02_unsettled(self):
-        """
-        Verify the link unsettled count by granting less credit than required
-        by the sender
-        """
-        test = self.LinkCountersTest(self.router.addresses[0],
-                                     presettled=False,
-                                     count=self.COUNT,
-                                     rx_limit=self.CREDIT,
-                                     credit=self.CREDIT)
-        test.run()
-
-        # expect the receiver to get rx_limit worth of unsettled deliveries
-        self.assertEqual(test.receiver_stats['deliveryCount'], self.CREDIT)
-        self.assertEqual(test.receiver_stats['unsettledCount'], self.CREDIT)
-        self.assertTrue(_link_stats_are_zero(test.receiver_stats,
-                                             _LINK_STATISTIC_KEYS
-                                             - set(['deliveryCount',
-                                                    'unsettledCount'])))
-
-        # expect sender only to be able to send as much as credit
-        self.assertEqual(test.sender_stats['deliveryCount'], self.CREDIT)
-        self.assertEqual(test.sender_stats['unsettledCount'], self.CREDIT)
-        self.assertTrue(_link_stats_are_zero(test.sender_stats,
-                                             _LINK_STATISTIC_KEYS
-                                             - set(['deliveryCount',
-                                                    'unsettledCount'])))
-
-    def test_03_released(self):
-        """
-        Verify the link released count by releasing all received messages
-        """
-        test = self.LinkCountersTest(self.router.addresses[0],
-                                     outcome=Delivery.RELEASED)
-        test.run()
-        self.assertEqual(test.receiver_stats['deliveryCount'], self.COUNT)
-        self.assertEqual(test.receiver_stats['releasedCount'], self.COUNT)
-        self.assertTrue(_link_stats_are_zero(test.receiver_stats,
-                                             _LINK_STATISTIC_KEYS
-                                             - set(['deliveryCount',
-                                                    'releasedCount'])))
-
-        self.assertEqual(test.sender_stats['deliveryCount'], self.COUNT)
-        self.assertEqual(test.sender_stats['releasedCount'], self.COUNT)
-        self.assertTrue(_link_stats_are_zero(test.sender_stats,
-                                             _LINK_STATISTIC_KEYS
-                                             - set(['deliveryCount',
-                                                    'releasedCount'])))
-
-    def test_04_one_credit_accepted(self):
+    def verify_one_credit_accepted(self, large_message=False):
         """
         Verify counters on a credit-blocked link
         """
@@ -1097,6 +1177,31 @@ class OneRouterLinkCountersTest(TestCase):
                                                     'unsettledCount',
                                                     'acceptedCount'])))
 
+    def test_01_presettled(self):
+        self.verify_presettled_count()
+
+    def test_02_large_mesage_presettled(self):
+        self.verify_presettled_count(True)
+
+    def test_03_unsettled(self):
+        self.verify_presettled_count()
+
+    def test_04_large_message_unsettled(self):
+        self.verify_presettled_count(True)
+
+    def test_05_released(self):
+        self.verify_released()
+
+    def test_06_large_message_released(self):
+        self.verify_released(True)
+
+    def test_07_one_credit_accepted(self):
+        self.verify_one_credit_accepted()
+
+    def test_08_large_message_one_credit_accepted(self):
+        self.verify_one_credit_accepted(True)
+
+
 
 class RouteContainerIngressCount(TestCase):
     @classmethod
@@ -1158,7 +1263,7 @@ class RouteContainerIngressCount(TestCase):
 
 
 class IngressEgressTwoRouterTest(MessagingHandler):
-    def __init__(self, sender_address, receiver_address):
+    def __init__(self, sender_address, receiver_address, num_messages, large_message=False):
         super(IngressEgressTwoRouterTest, self).__init__()
         self.sender = None
         self.receiver = None
@@ -1170,12 +1275,13 @@ class IngressEgressTwoRouterTest(MessagingHandler):
         self.receiver_address = receiver_address
         self.n_sent = 0
         self.n_received = 0
-        self.num_messages = 10
+        self.num_messages = num_messages
         self.start = False
         self.n_accept = 0
         self.sender_stats = None
         self.receiver_stats = None
         self.done = False
+        self.large_message = large_message
 
     def timeout(self):
         self.conn_sender.close()
@@ -1204,7 +1310,7 @@ class IngressEgressTwoRouterTest(MessagingHandler):
             return
 
         if self.n_sent < self.num_messages:
-            msg = Message(body={'number': self.n_sent})
+            msg = Message(body=get_body(self.n_sent, self.large_message))
             self.sender.send(msg)
             self.n_sent += 1
 
@@ -1230,7 +1336,7 @@ class IngressEgressTwoRouterTest(MessagingHandler):
 
 
 class IngressEgressOneRouterTest(MessagingHandler):
-    def __init__(self, address):
+    def __init__(self, address, num_messages, large_message=False):
         super(IngressEgressOneRouterTest, self).__init__()
         self.sender = None
         self.receiver = None
@@ -1241,10 +1347,11 @@ class IngressEgressOneRouterTest(MessagingHandler):
         self.n_sent = 0
         self.n_received = 0
         self.n_accepted = 0
-        self.num_messages = 10
+        self.num_messages = num_messages
         self.sender_stats = None
         self.receiver_stats = None
         self.done = False
+        self.large_message = large_message
 
     def timeout(self):
         self.conn.close()
@@ -1270,7 +1377,7 @@ class IngressEgressOneRouterTest(MessagingHandler):
 
     def on_sendable(self, event):
         if self.n_sent < self.num_messages:
-            msg = Message(body={'number': self.n_sent})
+            msg = Message(body=get_body(self.n_sent, self.large_message))
             self.sender.send(msg)
             self.n_sent += 1
 
@@ -1287,7 +1394,7 @@ class IngressEgressOneRouterTest(MessagingHandler):
 
 
 class RouteContainerEgressTest(MessagingHandler):
-    def __init__(self, route_container_addr, sender_addr):
+    def __init__(self, route_container_addr, sender_addr, num_messages, large_message=False):
         super(RouteContainerEgressTest, self).__init__()
         self.sender_addr = sender_addr
         self.route_container_addr = route_container_addr
@@ -1302,7 +1409,7 @@ class RouteContainerEgressTest(MessagingHandler):
         self.n_sent = 0
         self.n_received = 0
         self.n_accepted = 0
-        self.num_messages = 10
+        self.num_messages = num_messages
         self.sender_stats = None
         self.receiver_stats = None
         self.done = False
@@ -1437,7 +1544,7 @@ class RouteContainerIngressTest(MessagingHandler):
 
 
 class IngressEgressTransitLinkRouteTest(MessagingHandler):
-    def __init__(self, sender_addr, receiver_addr):
+    def __init__(self, sender_addr, receiver_addr, num_messages, large_message=False):
         super(IngressEgressTransitLinkRouteTest, self).__init__()
         self.timer = None
         self.receiver_conn = None
@@ -1447,7 +1554,7 @@ class IngressEgressTransitLinkRouteTest(MessagingHandler):
         self.dest = "pulp.task"
         self.start = False
         self.n_sent = 0
-        self.num_messages = 10
+        self.num_messages = num_messages
         self.n_received = 0
         self.n_accepted = 0
         self.sender_addr = sender_addr
@@ -1456,6 +1563,7 @@ class IngressEgressTransitLinkRouteTest(MessagingHandler):
         self.sender_stats = None
         self.receiver_stats = None
         self.done = False
+        self.large_message = large_message
 
     def timeout(self):
         self.error = "Timeout Expired: self.n_sent=%d self.n_received=%d" % (self.n_sent,
self.self.n_received)
@@ -1494,7 +1602,7 @@ class IngressEgressTransitLinkRouteTest(MessagingHandler):
             return
 
         if self.n_sent < self.num_messages:
-            msg = Message(body={'number': self.n_sent})
+            msg = Message(body=get_body(self.n_sent, self.large_message))
             self.sender.send(msg)
             self.n_sent += 1
 
@@ -1511,14 +1619,14 @@ class IngressEgressTransitLinkRouteTest(MessagingHandler):
 
 
 class ReleasedDroppedPresettledCountTest(MessagingHandler):
-    def __init__(self, sender_addr):
+    def __init__(self, sender_addr, num_messages, large_message=False):
         super(ReleasedDroppedPresettledCountTest, self).__init__()
         self.timer = None
         self.sender_conn = None
         self.sender = None
         self.error = None
         self.n_sent = 0
-        self.num_messages = 20
+        self.num_messages = num_messages
         self.sender_addr = sender_addr
         self.sender_stats = None
 
@@ -1527,6 +1635,7 @@ class ReleasedDroppedPresettledCountTest(MessagingHandler):
         self.n_released = 0
         self.expect_released = 10
         self.done = False
+        self.large_message = large_message
 
     def check_if_done(self):
         if not self.done and self.expect_released == self.n_released:
@@ -1552,7 +1661,7 @@ class ReleasedDroppedPresettledCountTest(MessagingHandler):
     def on_sendable(self, event):
         # We are sending a total of 20 deliveries. 10 unsettled and 10 pre-settled to a multicast
address
         if self.n_sent < self.num_messages:
-            msg = Message(body={'number': self.n_sent})
+            msg = Message(body=get_body(self.n_sent, self.large_message))
             msg.address = self.dest
             dlv = self.sender.send(msg)
             if self.n_sent < 10:
@@ -1568,13 +1677,13 @@ class ReleasedDroppedPresettledCountTest(MessagingHandler):
 
 
 class RejectedDeliveriesTest(MessagingHandler):
-    def __init__(self, addr):
+    def __init__(self, addr, num_messages, large_message=False):
         super(RejectedDeliveriesTest, self).__init__(auto_accept=False)
         self.addr = addr
         self.dest = "someaddress"
         self.error = None
         self.n_sent = 0
-        self.num_messages = 10
+        self.num_messages = num_messages
         self.n_rejected = 0
         self.sender_conn = None
         self.receiver_conn = None
@@ -1584,6 +1693,7 @@ class RejectedDeliveriesTest(MessagingHandler):
         self.sender_stats = None
         self.receiver_stats = None
         self.done = False
+        self.large_message = large_message
 
     def check_if_done(self):
         if not self.done and self.n_rejected == self.num_messages:
@@ -1620,7 +1730,7 @@ class RejectedDeliveriesTest(MessagingHandler):
 
     def on_sendable(self, event):
         if self.n_sent < self.num_messages:
-            msg = Message( body={'number': self.n_sent})
+            msg = Message(body=get_body(self.n_sent, self.large_message))
             self.sender.send(msg)
             self.n_sent += 1
 
@@ -1629,13 +1739,13 @@ class RejectedDeliveriesTest(MessagingHandler):
 
 
 class ModifiedDeliveriesTest(MessagingHandler):
-    def __init__(self, addr):
+    def __init__(self, addr, num_messages, large_message=False):
         super(ModifiedDeliveriesTest, self).__init__(auto_accept=False)
         self.addr = addr
         self.dest = "someaddress"
         self.error = None
         self.n_sent = 0
-        self.num_messages = 10
+        self.num_messages = num_messages
         self.n_modified = 0
         self.sender_conn = None
         self.receiver_conn = None
@@ -1646,6 +1756,7 @@ class ModifiedDeliveriesTest(MessagingHandler):
         self.sender_stats = None
         self.receiver_stats = None
         self.done = False
+        self.large_message = large_message
 
     def check_if_done(self):
         if not self.done and self.n_modified == self.num_messages:
@@ -1688,7 +1799,7 @@ class ModifiedDeliveriesTest(MessagingHandler):
 
     def on_sendable(self, event):
         if self.n_sent < self.num_messages:
-            msg = Message(body={'number': self.n_sent})
+            msg = Message(body=get_body(self.n_sent, self.large_message))
             self.sender.send(msg)
             self.n_sent += 1
 


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


Mime
View raw message