Author: chug Date: Fri Jun 13 20:28:32 2014 New Revision: 1602513 URL: http://svn.apache.org/r1602513 Log: PROTON-606: Python testReclaimCredit exposes test server messenger hang on windows Move client2 into NBMessengerTest scope and include it in main pump loop.
Modified: qpid/proton/trunk/tests/python/proton_tests/messenger.py Modified: qpid/proton/trunk/tests/python/proton_tests/messenger.py URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/messenger.py?rev=1602513&r1=1602512&r2=1602513&view=diff ============================================================================== --- qpid/proton/trunk/tests/python/proton_tests/messenger.py (original) +++ qpid/proton/trunk/tests/python/proton_tests/messenger.py Fri Jun 13 20:28:32 2014 @@ -695,26 +695,40 @@ class NBMessengerTest(common.Test): def setup(self): self.client = Messenger("client") + self.client2 = Messenger("client2") self.server = Messenger("server") + self.messengers = [self.client, self.client2, self.server] self.client.blocking = False + self.client2.blocking = False self.server.blocking = False self.server.start() self.client.start() + self.client2.start() self.address = "amqp://0.0.0.0:12345" self.server.subscribe("amqp://~0.0.0.0:12345") + def _pump(self, timeout): + for msgr in self.messengers: + if not msgr.stopped: + if msgr.work(timeout): + return True + return False + def pump(self, timeout=0): - while self.client.work(0) or self.server.work(0): pass - self.client.work(timeout) - self.server.work(timeout) - while self.client.work(0) or self.server.work(0): pass + while self._pump(0): pass + for msgr in self.messengers: + if not msgr.stopped: + msgr.work(timeout) + while self._pump(0): pass def teardown(self): self.server.stop() self.client.stop() + self.client2.stop() self.pump() assert self.server.stopped assert self.client.stopped + assert self.client2.stopped def testSmoke(self, count=1): self.server.recv() @@ -848,14 +862,10 @@ class NBMessengerTest(common.Test): assert self.server.receiving == 8, self.server.receiving # and none for this new client - client2 = Messenger("client2") - client2.blocking = False - client2.start() msg3 = Message() msg3.address = self.address + "/msg3" - client2.put(msg3) - while client2.work(0): - self.pump() + self.client2.put(msg3) + self.pump() # eventually, credit will rebalance and all links will # send a message @@ -863,7 +873,6 @@ class NBMessengerTest(common.Test): while time() < deadline: sleep(.1) self.pump() - client2.work(0) if self.server.incoming == 3: break; assert self.server.incoming == 3, self.server.incoming @@ -871,7 +880,7 @@ class NBMessengerTest(common.Test): # now tear down client two, this should cause its outstanding credit to be # made available to the other links - client2.stop() + self.client2.stop() self.pump() for i in range(4): --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org