From 70942a357f992ec3efd820bc0736baa276c31660 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Wed, 2 Jan 2013 14:44:45 +0000 Subject: Ensure proxy callback threads exit during tests On the consumer side, each message is consumed in a separate thread but we currently have no way of waiting for all these threads to complete. In BaseRpcTestCase.test_call_timeout(), we complete the thread while there is still a message handler running on the other side. This can mean the consumer attempting to send its reply while other tests are running, which clearly is a bad thing. Make the connection close() and reset() methods in the kombu and qpid drivers wait on proxy object threads before returning to avoid this situation. Change-Id: I8fb84b1dc7f31196ef27a5d1f8c4a3346b03e0ae --- openstack/common/rpc/amqp.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'openstack/common/rpc/amqp.py') diff --git a/openstack/common/rpc/amqp.py b/openstack/common/rpc/amqp.py index 00b2f24..2f90a9b 100644 --- a/openstack/common/rpc/amqp.py +++ b/openstack/common/rpc/amqp.py @@ -293,6 +293,10 @@ class ProxyCallback(object): ctxt.reply(None, sys.exc_info(), connection_pool=self.connection_pool) + def wait(self): + """Wait for all callback threads to exit.""" + self.pool.waitall() + class MulticallWaiter(object): def __init__(self, conf, connection, timeout): -- cgit