DISPATCH-993: Get test to complete in when messages are released This commit is the heart of the Jira fix.
If enough messages are released then the test never sends enough messages to trigger the spurious link deletion. The send count is now (n_messages + n_released). Test 01 debug reports the number and time elapsed for leading released messages in the message stream. Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/3d248c11 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/3d248c11 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/3d248c11 Branch: refs/heads/master Commit: 3d248c11d54a41b2efb20cf0b60a113e39f48aa9 Parents: 239afae Author: Chuck Rolke <[email protected]> Authored: Fri Jul 20 10:13:35 2018 -0400 Committer: Chuck Rolke <[email protected]> Committed: Fri Jul 20 10:13:35 2018 -0400 ---------------------------------------------------------------------- tests/system_tests_topology_disposition.py | 57 +++++++++++++++++++------ 1 file changed, 45 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/3d248c11/tests/system_tests_topology_disposition.py ---------------------------------------------------------------------- diff --git a/tests/system_tests_topology_disposition.py b/tests/system_tests_topology_disposition.py index a5cf251..daba701 100644 --- a/tests/system_tests_topology_disposition.py +++ b/tests/system_tests_topology_disposition.py @@ -201,7 +201,19 @@ class TopologyDispositionTests ( TestCase ): cls.cost [ 'CD' ] = 1 # Add an extra, high-cost connection between A and D. - # This will be deleted in the first test. + # This will be deleted in the first test. Note that + # "more than one inter-router connections between two + # routers" is _not_ a supported configuration. + # Any of the connections may be used and the others are + # ignored. The multiple connections do not act as a + # "hot standby" nor as a "trunking" setup where the + # traffic between the routers is shared across the + # connections. + # If the active connection is lost then the multiple + # connections are all considered for election and one + # of them is chosen. The router does not seamlessly + # transfer the load to the unaffected connection. + cls.cost [ 'AD2' ] = 11 client_link_capacity = 1000 @@ -405,6 +417,12 @@ class TopologyDispositionTests ( TestCase ): class DeleteSpuriousConnector ( MessagingHandler ): """ + Connect receiver (to B) and sender (to A) to router network. + Start sending batches of messages to router A. + Messages are released by router D until the route mobile + address closest/0 is propagated to router D. + Once messages are accepted then the route is fully established + and messages must not be released after that. """ def __init__ ( self, test_name, client_addrs, destination, D_client_addr ): super ( DeleteSpuriousConnector, self).__init__(prefetch=100) @@ -438,6 +456,9 @@ class DeleteSpuriousConnector ( MessagingHandler ): self.confirmed_kill = False + self.first_released = None + self.first_received = None + def debug_print ( self, text ) : if self.debug == True: @@ -458,7 +479,7 @@ class DeleteSpuriousConnector ( MessagingHandler ): # Call this from all handlers of dispositions returning to the sender. def bail_out_if_done ( self ) : - if self.n_accepted + self.n_released >= self.n_messages : + if self.n_accepted + self.n_released >= self.max_to_send() : # We have received everything. But! Did we get a confirmed kill on the connector? if not self.confirmed_kill : # This is a failure. @@ -564,29 +585,44 @@ class DeleteSpuriousConnector ( MessagingHandler ): # Sender Side #======================================================= + def max_to_send ( self ) : + return self.n_messages + self.n_released + + def send ( self ) : - if self.n_sent >= self.n_messages : + if self.n_sent >= self.max_to_send() : return for _ in range ( self.burst_size ) : - if self.sender.credit > 0 and self.n_sent < self.n_messages : - msg = Message ( body=self.n_sent ) - self.n_sent += 1 - self.sender.send ( msg ) - self.debug_print ( "sent: %d" % self.n_sent ) + if self.sender.credit > 0 : + if self.n_sent < self.max_to_send() : + msg = Message ( body=self.n_sent ) + self.n_sent += 1 + self.sender.send ( msg ) + self.debug_print ( "sent: %d" % self.n_sent ) + else : + pass else : self.debug_print ( "sender has no credit." ) - def on_accepted ( self, event ): + def on_accepted ( self, event ) : + if self.first_received is None : + self.first_received = time.time() + if not self.first_released is None : + self.debug_print ( "Accepted first message. %d messages released in %.6lf seconds" % \ + ( self.n_released, self.first_received - self.first_released ) ) self.n_accepted += 1 self.debug_print ( "on_accepted %d" % self.n_accepted ) self.bail_out_if_done ( ) def on_released ( self, event ) : + if self.first_released is None : + self.first_released = time.time() self.n_released += 1 + self.receiver.flow ( 1 ) self.debug_print ( "on_released %d" % self.n_released ) self.bail_out_if_done ( ) @@ -606,9 +642,6 @@ class DeleteSpuriousConnector ( MessagingHandler ): self.kill_the_connector ( ) - - - class TopologyDisposition ( MessagingHandler ): """ Test that disposition guarantee survives catastrophic --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
