diff --git a/coolamqp/cluster.py b/coolamqp/cluster.py index 6ebd56afa308afcb13df7151fcc262d3ca88742d..66a7e02ec58c2aff528c9949a1d90e8c602c6f8d 100644 --- a/coolamqp/cluster.py +++ b/coolamqp/cluster.py @@ -201,8 +201,4 @@ class Cluster(object): """ self.thread.terminate() self.thread.join() - - if self.connected: - self.backend.shutdown() - self.backend = None - self.connected = False + # thread closes the AMQP uplink for us diff --git a/coolamqp/handler.py b/coolamqp/handler.py index 9705407d19cc9718bf3225d13ee6d383b7afa1ac..93e2f056d6f88327a592ff3adce2643a1214d1eb 100644 --- a/coolamqp/handler.py +++ b/coolamqp/handler.py @@ -17,7 +17,7 @@ logger = logging.getLogger(__name__) class ClusterHandlerThread(threading.Thread): """ - Thread that does bookkeeping for a Cluster + Thread that does bookkeeping for a Cluster. """ def __init__(self, cluster): """ diff --git a/tests/test_basics.py b/tests/test_basics.py index 1491104a2ecd1594b35b85d808d2b118f950244a..14b949be01107ca5c67ead13c4aad4bb15cba19b 100644 --- a/tests/test_basics.py +++ b/tests/test_basics.py @@ -55,6 +55,19 @@ class TestBasics(unittest.TestCase): self.amqp.consume(p) self.amqp.consume(p).result() + def test_consume_declare(self): + """Spawn a second connection. One declares an exclusive queue, other tries to consume from it""" + amqp2 = getamqp() + + has_failed = {'has_failed': False} + + self.amqp.declare_queue(Queue('lol', exclusive=True)).result() + amqp2.consume(Queue('lol', exclusive=True), on_failed=lambda e: has_failed.update({'has_failed': True})).result() + + self.assertTrue(has_failed['has_failed']) + + amqp2.shutdown() + def test_consume_twice(self): """Spawn a second connection and try to consume an exclusive queue twice""" amqp2 = getamqp()