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 a770e9c  DISPATCH-1746: Set the waypoint sender and the receiver only 
once
a770e9c is described below

commit a770e9c5c9d40f40808a2bccf31b03be400b6a95
Author: Ganesh Murthy <gmur...@apache.org>
AuthorDate: Thu Aug 6 17:17:35 2020 -0400

    DISPATCH-1746: Set the waypoint sender and the receiver only once
---
 tests/system_tests_multi_tenancy.py | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/tests/system_tests_multi_tenancy.py 
b/tests/system_tests_multi_tenancy.py
index fa04976..d34c825 100644
--- a/tests/system_tests_multi_tenancy.py
+++ b/tests/system_tests_multi_tenancy.py
@@ -829,6 +829,9 @@ class WaypointTest(MessagingHandler):
         self.waypoint_sender   = None
         self.waypoint_receiver = None
         self.waypoint_queue    = []
+        self.waypoint_sender_opened = False
+        self.waypoint_receiver_opened = False
+        self.firsts_created = False
 
         self.count  = 10
         self.n_sent = 0
@@ -863,30 +866,33 @@ class WaypointTest(MessagingHandler):
         self.first_conn  = event.container.connect(self.first_host)
         self.second_conn = event.container.connect(self.second_host)
 
-    def on_connection_opened(self, event):
-        if event.connection == self.first_conn:
-            self.first_sender   = 
event.container.create_sender(self.first_conn, self.first_address)
-            self.first_receiver = 
event.container.create_receiver(self.first_conn, self.first_address)
-
     def on_link_opening(self, event):
-        if event.sender:
+        if event.sender and not self.waypoint_sender:
             self.waypoint_sender = event.sender
             if event.sender.remote_source.address == self.second_address:
                 event.sender.source.address = self.second_address
                 event.sender.open()
+                self.waypoint_sender_opened = True
             else:
                 self.fail("Incorrect address on incoming sender: got %s, 
expected %s" %
                           (event.sender.remote_source.address, 
self.second_address))
 
-        elif event.receiver:
+        elif event.receiver and not self.waypoint_receiver:
             self.waypoint_receiver = event.receiver
             if event.receiver.remote_target.address == self.second_address:
                 event.receiver.target.address = self.second_address
                 event.receiver.open()
+                self.waypoint_receiver_opened = True
             else:
                 self.fail("Incorrect address on incoming receiver: got %s, 
expected %s" %
                           (event.receiver.remote_target.address, 
self.second_address))
 
+        if self.waypoint_sender_opened and self.waypoint_receiver_opened and 
not self.firsts_created:
+            self.firsts_created = True
+            self.first_sender = event.container.create_sender(self.first_conn,
+                                                              
self.first_address)
+            self.first_receiver = 
event.container.create_receiver(self.first_conn,
+                                                                  
self.first_address)
 
     def on_sendable(self, event):
         if event.sender == self.first_sender:


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

Reply via email to