Merge lp:~therve/txamqp/multiple-broker-testing into lp:txamqp

Proposed by Thomas Herve
Status: Merged
Merged at revision: not available
Proposed branch: lp:~therve/txamqp/multiple-broker-testing
Merge into: lp:txamqp
Diff against target: None lines
To merge this branch: bzr merge lp:~therve/txamqp/multiple-broker-testing
Reviewer Review Type Date Requested Status
Esteve Fernandez Approve
Review via email: mp+7280@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Thomas Herve (therve) wrote :

This the work we did during UDS, to make the test suite pass under RabbitMQ, supporting several brokers. I think this is mostly done and just needed some testing under OpenAMQ.

Revision history for this message
Esteve Fernandez (esteve) wrote :

> This the work we did during UDS, to make the test suite pass under RabbitMQ,
> supporting several brokers. I think this is mostly done and just needed some
> testing under OpenAMQ.

I added support for OpenAMQ and renamed skipBroker to supportedBrokers in another branch (lp:~esteve/txamqp/multiple-brokers-support). Is there a way to incorporate it into this review or do I have to create another one?

Revision history for this message
Esteve Fernandez (esteve) :
review: Approve
Revision history for this message
Thomas Herve (therve) wrote :

> > This the work we did during UDS, to make the test suite pass under RabbitMQ,
> > supporting several brokers. I think this is mostly done and just needed some
> > testing under OpenAMQ.
>
> I added support for OpenAMQ and renamed skipBroker to supportedBrokers in
> another branch (lp:~esteve/txamqp/multiple-brokers-support). Is there a way to
> incorporate it into this review or do I have to create another one?

I think it's fine, you should go on and merged it. Thanks!

Revision history for this message
Esteve Fernandez (esteve) wrote :

> > > This the work we did during UDS, to make the test suite pass under
> RabbitMQ,
> > > supporting several brokers. I think this is mostly done and just needed
> some
> > > testing under OpenAMQ.
> >
> > I added support for OpenAMQ and renamed skipBroker to supportedBrokers in
> > another branch (lp:~esteve/txamqp/multiple-brokers-support). Is there a way
> to
> > incorporate it into this review or do I have to create another one?
>
> I think it's fine, you should go on and merged it. Thanks!

Done. Thank you!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/txamqp/test/test_basic.py'
--- src/txamqp/test/test_basic.py 2008-10-29 18:31:04 +0000
+++ src/txamqp/test/test_basic.py 2009-05-28 09:20:47 +0000
@@ -19,13 +19,14 @@
19from txamqp.client import Closed19from txamqp.client import Closed
20from txamqp.queue import Empty20from txamqp.queue import Empty
21from txamqp.content import Content21from txamqp.content import Content
22from txamqp.testlib import TestBase22from txamqp.testlib import TestBase, skipBroker, QPID
2323
24from twisted.internet.defer import inlineCallbacks24from twisted.internet.defer import inlineCallbacks
2525
26class BasicTests(TestBase):26class BasicTests(TestBase):
27 """Tests for 'methods' on the amqp basic 'class'"""27 """Tests for 'methods' on the amqp basic 'class'"""
2828
29 @skipBroker(QPID)
29 @inlineCallbacks30 @inlineCallbacks
30 def test_consume_no_local(self):31 def test_consume_no_local(self):
31 """32 """
@@ -248,6 +249,7 @@
248 self.fail("Got unexpected message in original queue: " + extra.content.body)249 self.fail("Got unexpected message in original queue: " + extra.content.body)
249 except Empty: None250 except Empty: None
250 251
252 @skipBroker(QPID)
251 @inlineCallbacks253 @inlineCallbacks
252 def test_qos_prefetch_count(self):254 def test_qos_prefetch_count(self):
253 """255 """
@@ -289,6 +291,7 @@
289 self.fail("Got unexpected 11th message in original queue: " + extra.content.body)291 self.fail("Got unexpected 11th message in original queue: " + extra.content.body)
290 except Empty: None292 except Empty: None
291293
294 @skipBroker(QPID)
292 @inlineCallbacks295 @inlineCallbacks
293 def test_qos_prefetch_size(self):296 def test_qos_prefetch_size(self):
294 """297 """
295298
=== modified file 'src/txamqp/test/test_broker.py'
--- src/txamqp/test/test_broker.py 2008-10-29 18:31:04 +0000
+++ src/txamqp/test/test_broker.py 2009-05-28 09:20:47 +0000
@@ -19,7 +19,7 @@
19from txamqp.client import Closed19from txamqp.client import Closed
20from txamqp.queue import Empty20from txamqp.queue import Empty
21from txamqp.content import Content21from txamqp.content import Content
22from txamqp.testlib import TestBase22from txamqp.testlib import TestBase, skipBroker, QPID
2323
24from twisted.internet.defer import inlineCallbacks24from twisted.internet.defer import inlineCallbacks
2525
@@ -109,6 +109,7 @@
109 except Closed, e:109 except Closed, e:
110 self.assertConnectionException(504, e.args[0])110 self.assertConnectionException(504, e.args[0])
111111
112 @skipBroker(QPID)
112 @inlineCallbacks113 @inlineCallbacks
113 def test_channel_flow(self):114 def test_channel_flow(self):
114 channel = self.channel115 channel = self.channel
115116
=== modified file 'src/txamqp/test/test_exchange.py'
--- src/txamqp/test/test_exchange.py 2008-10-29 18:31:04 +0000
+++ src/txamqp/test/test_exchange.py 2009-05-28 09:20:47 +0000
@@ -24,7 +24,7 @@
24"""24"""
2525
26from txamqp.queue import Empty26from txamqp.queue import Empty
27from txamqp.testlib import TestBase27from txamqp.testlib import TestBase, skipBroker, QPID
28from txamqp.content import Content28from txamqp.content import Content
29from txamqp.client import Closed29from txamqp.client import Closed
3030
@@ -109,6 +109,7 @@
109 yield self.exchange_declare(0, exchange="t", type="topic")109 yield self.exchange_declare(0, exchange="t", type="topic")
110 yield self.verifyTopicExchange("t")110 yield self.verifyTopicExchange("t")
111111
112 @skipBroker(QPID)
112 @inlineCallbacks113 @inlineCallbacks
113 def testHeaders(self):114 def testHeaders(self):
114 """Declare and test a headers exchange"""115 """Declare and test a headers exchange"""
@@ -138,6 +139,7 @@
138 def testAmqTopic(self):139 def testAmqTopic(self):
139 yield self.verifyTopicExchange("amq.topic")140 yield self.verifyTopicExchange("amq.topic")
140 141
142 @skipBroker(QPID)
141 @inlineCallbacks143 @inlineCallbacks
142 def testAmqMatch(self):144 def testAmqMatch(self):
143 yield self.verifyHeadersExchange("amq.match")145 yield self.verifyHeadersExchange("amq.match")
@@ -299,6 +301,7 @@
299 def myBasicPublish(self, headers):301 def myBasicPublish(self, headers):
300 self.channel.basic_publish(exchange="amq.match", content=Content("foobar", properties={'headers':headers}))302 self.channel.basic_publish(exchange="amq.match", content=Content("foobar", properties={'headers':headers}))
301303
304 @skipBroker(QPID)
302 @inlineCallbacks305 @inlineCallbacks
303 def testMatchAll(self):306 def testMatchAll(self):
304 yield self.channel.queue_bind(queue="q", exchange="amq.match", arguments={ 'x-match':'all', "name":"fred", "age":3})307 yield self.channel.queue_bind(queue="q", exchange="amq.match", arguments={ 'x-match':'all', "name":"fred", "age":3})
@@ -312,6 +315,7 @@
312 self.myBasicPublish({"name":"fred", "age":2})315 self.myBasicPublish({"name":"fred", "age":2})
313 yield self.assertEmpty(self.q)316 yield self.assertEmpty(self.q)
314317
318 @skipBroker(QPID)
315 @inlineCallbacks319 @inlineCallbacks
316 def testMatchAny(self):320 def testMatchAny(self):
317 yield self.channel.queue_bind(queue="q", exchange="amq.match", arguments={ 'x-match':'any', "name":"fred", "age":3})321 yield self.channel.queue_bind(queue="q", exchange="amq.match", arguments={ 'x-match':'any', "name":"fred", "age":3})
318322
=== modified file 'src/txamqp/test/test_tx.py'
--- src/txamqp/test/test_tx.py 2008-10-29 18:31:04 +0000
+++ src/txamqp/test/test_tx.py 2009-05-28 09:20:47 +0000
@@ -19,7 +19,7 @@
19from txamqp.client import Closed19from txamqp.client import Closed
20from txamqp.queue import Empty20from txamqp.queue import Empty
21from txamqp.content import Content21from txamqp.content import Content
22from txamqp.testlib import TestBase22from txamqp.testlib import TestBase, skipBroker, QPID
2323
24from twisted.internet.defer import inlineCallbacks, returnValue24from twisted.internet.defer import inlineCallbacks, returnValue
2525
@@ -58,6 +58,7 @@
58 channel.basic_ack(delivery_tag=0, multiple=True)58 channel.basic_ack(delivery_tag=0, multiple=True)
59 yield channel.tx_commit()59 yield channel.tx_commit()
6060
61 @skipBroker(QPID)
61 @inlineCallbacks62 @inlineCallbacks
62 def test_auto_rollback(self):63 def test_auto_rollback(self):
63 """64 """
@@ -95,6 +96,7 @@
95 channel.basic_ack(delivery_tag=0, multiple=True)96 channel.basic_ack(delivery_tag=0, multiple=True)
96 yield channel.tx_commit()97 yield channel.tx_commit()
9798
99 @skipBroker(QPID)
98 @inlineCallbacks100 @inlineCallbacks
99 def test_rollback(self):101 def test_rollback(self):
100 """102 """
101103
=== modified file 'src/txamqp/testlib.py'
--- src/txamqp/testlib.py 2009-02-11 22:28:45 +0000
+++ src/txamqp/testlib.py 2009-06-10 12:38:18 +0000
@@ -17,6 +17,9 @@
17# under the License.17# under the License.
18#18#
1919
20import os
21import warnings
22
20from txamqp.content import Content23from txamqp.content import Content
21import txamqp.spec24import txamqp.spec
2225
@@ -28,6 +31,27 @@
28from twisted.python import failure31from twisted.python import failure
29from txamqp.queue import Empty32from txamqp.queue import Empty
3033
34
35RABBITMQ = "RABBITMQ"
36OPENAMQ = "OPENAMQ"
37QPID = "QPID"
38
39
40class skipBroker(object):
41
42 def __init__(self, *supporterBrokers):
43 self.supporterBrokers = supporterBrokers
44
45 def __call__(self, f):
46 if _get_broker() not in self.supporterBrokers:
47 f.skip = "Not supported for this broker."
48 return f
49
50
51def _get_broker():
52 return os.environ.get("TXAMQP_BROKER")
53
54
31class TestBase(unittest.TestCase):55class TestBase(unittest.TestCase):
3256
33 def __init__(self, *args, **kwargs):57 def __init__(self, *args, **kwargs):
@@ -35,7 +59,22 @@
3559
36 self.host = 'localhost'60 self.host = 'localhost'
37 self.port = 567261 self.port = 5672
38 self.spec = '../specs/qpid/amqp.0-8.xml'62 broker = _get_broker()
63 if broker is None:
64 warnings.warn(
65 "Using default broker rabbitmq. Define TXAMQP_BROKER "
66 "environment variable to customized it.")
67 broker = RABBITMQ
68 if broker == RABBITMQ:
69 self.spec = '../specs/standard/amqp0-8.xml'
70 elif broker == OPENAMQ:
71 self.spec = '../specs/standard/amqp0-9.xml'
72 elif broker == QPID:
73 self.spec = '../specs/qpid/amqp.0-8.xml'
74 else:
75 raise RuntimeError(
76 "Unsupported broker '%s'. Use one of RABBITMQ, OPENAMQ or "
77 "QPID" % broker)
39 self.user = 'guest'78 self.user = 'guest'
40 self.password = 'guest'79 self.password = 'guest'
41 self.vhost = 'localhost'80 self.vhost = 'localhost'

Subscribers

People subscribed via source and target branches

to status/vote changes: