diff --git a/coolamqp/attaches/consumer.py b/coolamqp/attaches/consumer.py index 354afb6b8985ab29df14dca7440fee3407aecb0a..74bd4dcf063e8e087355e9249b7693e09d31eded 100644 --- a/coolamqp/attaches/consumer.py +++ b/coolamqp/attaches/consumer.py @@ -113,6 +113,7 @@ class Consumer(Channeler): we simply trash the channel. Idk if it's a good idea... .ack() or .nack() for messages from this customer will have no effect. + :return: a Future to tell when it's done. The future will always succeed - sooner, or later. """ self.cancelled = True self.method(ChannelClose(0, b'consumer cancelled', 0, 0)) diff --git a/tests/test_clustering/test_a.py b/tests/test_clustering/test_a.py index 7e517899019bcbff1c80d5825ee645153ce549c8..8cadf4c24435bbb1817c13181751e4969d51f953 100644 --- a/tests/test_clustering/test_a.py +++ b/tests/test_clustering/test_a.py @@ -30,6 +30,21 @@ class TestA(unittest.TestCase): fut.result() con.cancel() + + def test_set_qos_but_later(self): + con, fut = self.c.consume(Queue(u'hello', exclusive=True)) + + fut.result() + + con.set_qos(100, 100) + time.sleep(1) + self.assertEquals(con.qos, (100, 100)) + + con.set_qos(None, 110) + time.sleep(1) + self.assertEquals(con.qos, (0, 110)) + + def test_send_recv_zerolen(self): P = {'q': False} @@ -105,3 +120,8 @@ class TestA(unittest.TestCase): self.assertTrue(P['q']) + + def test_consumer_cancel(self): + con, fut = self.c.consume(Queue(u'hello', exclusive=True, auto_delete=True)) + fut.result() + con.cancel().result() \ No newline at end of file diff --git a/tests/test_clustering/test_double.py b/tests/test_clustering/test_double.py index 038e247e1b1c557a03d608d38f07324f13e2344b..f31e27559a0135abac1ce6a3fae388b4c9195a1e 100644 --- a/tests/test_clustering/test_double.py +++ b/tests/test_clustering/test_double.py @@ -9,7 +9,7 @@ import time, logging, threading from coolamqp.objects import Message, MessageProperties, NodeDefinition, Queue, ReceivedMessage from coolamqp.clustering import Cluster NODE = NodeDefinition('127.0.0.1', 'guest', 'guest', heartbeat=20) - +from coolamqp.exceptions import ResourceLocked class TestDouble(unittest.TestCase): @@ -28,13 +28,9 @@ class TestDouble(unittest.TestCase): q = Queue(u'yo', exclusive=True, auto_delete=True) - con, fut = self.c1.consume(q) + con, fut = self.c1.consume(q, qos=(None, 20)) fut.result() con2, fut2 = self.c2.consume(q, fail_on_first_time_resource_locked=True) - from coolamqp.exceptions import ResourceLocked - self.assertRaises(ResourceLocked, lambda: fut2.result()) - -