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
1=== modified file 'src/txamqp/test/test_basic.py'
2--- src/txamqp/test/test_basic.py 2008-10-29 18:31:04 +0000
3+++ src/txamqp/test/test_basic.py 2009-05-28 09:20:47 +0000
4@@ -19,13 +19,14 @@
5 from txamqp.client import Closed
6 from txamqp.queue import Empty
7 from txamqp.content import Content
8-from txamqp.testlib import TestBase
9+from txamqp.testlib import TestBase, skipBroker, QPID
10
11 from twisted.internet.defer import inlineCallbacks
12
13 class BasicTests(TestBase):
14 """Tests for 'methods' on the amqp basic 'class'"""
15
16+ @skipBroker(QPID)
17 @inlineCallbacks
18 def test_consume_no_local(self):
19 """
20@@ -248,6 +249,7 @@
21 self.fail("Got unexpected message in original queue: " + extra.content.body)
22 except Empty: None
23
24+ @skipBroker(QPID)
25 @inlineCallbacks
26 def test_qos_prefetch_count(self):
27 """
28@@ -289,6 +291,7 @@
29 self.fail("Got unexpected 11th message in original queue: " + extra.content.body)
30 except Empty: None
31
32+ @skipBroker(QPID)
33 @inlineCallbacks
34 def test_qos_prefetch_size(self):
35 """
36
37=== modified file 'src/txamqp/test/test_broker.py'
38--- src/txamqp/test/test_broker.py 2008-10-29 18:31:04 +0000
39+++ src/txamqp/test/test_broker.py 2009-05-28 09:20:47 +0000
40@@ -19,7 +19,7 @@
41 from txamqp.client import Closed
42 from txamqp.queue import Empty
43 from txamqp.content import Content
44-from txamqp.testlib import TestBase
45+from txamqp.testlib import TestBase, skipBroker, QPID
46
47 from twisted.internet.defer import inlineCallbacks
48
49@@ -109,6 +109,7 @@
50 except Closed, e:
51 self.assertConnectionException(504, e.args[0])
52
53+ @skipBroker(QPID)
54 @inlineCallbacks
55 def test_channel_flow(self):
56 channel = self.channel
57
58=== modified file 'src/txamqp/test/test_exchange.py'
59--- src/txamqp/test/test_exchange.py 2008-10-29 18:31:04 +0000
60+++ src/txamqp/test/test_exchange.py 2009-05-28 09:20:47 +0000
61@@ -24,7 +24,7 @@
62 """
63
64 from txamqp.queue import Empty
65-from txamqp.testlib import TestBase
66+from txamqp.testlib import TestBase, skipBroker, QPID
67 from txamqp.content import Content
68 from txamqp.client import Closed
69
70@@ -109,6 +109,7 @@
71 yield self.exchange_declare(0, exchange="t", type="topic")
72 yield self.verifyTopicExchange("t")
73
74+ @skipBroker(QPID)
75 @inlineCallbacks
76 def testHeaders(self):
77 """Declare and test a headers exchange"""
78@@ -138,6 +139,7 @@
79 def testAmqTopic(self):
80 yield self.verifyTopicExchange("amq.topic")
81
82+ @skipBroker(QPID)
83 @inlineCallbacks
84 def testAmqMatch(self):
85 yield self.verifyHeadersExchange("amq.match")
86@@ -299,6 +301,7 @@
87 def myBasicPublish(self, headers):
88 self.channel.basic_publish(exchange="amq.match", content=Content("foobar", properties={'headers':headers}))
89
90+ @skipBroker(QPID)
91 @inlineCallbacks
92 def testMatchAll(self):
93 yield self.channel.queue_bind(queue="q", exchange="amq.match", arguments={ 'x-match':'all', "name":"fred", "age":3})
94@@ -312,6 +315,7 @@
95 self.myBasicPublish({"name":"fred", "age":2})
96 yield self.assertEmpty(self.q)
97
98+ @skipBroker(QPID)
99 @inlineCallbacks
100 def testMatchAny(self):
101 yield self.channel.queue_bind(queue="q", exchange="amq.match", arguments={ 'x-match':'any', "name":"fred", "age":3})
102
103=== modified file 'src/txamqp/test/test_tx.py'
104--- src/txamqp/test/test_tx.py 2008-10-29 18:31:04 +0000
105+++ src/txamqp/test/test_tx.py 2009-05-28 09:20:47 +0000
106@@ -19,7 +19,7 @@
107 from txamqp.client import Closed
108 from txamqp.queue import Empty
109 from txamqp.content import Content
110-from txamqp.testlib import TestBase
111+from txamqp.testlib import TestBase, skipBroker, QPID
112
113 from twisted.internet.defer import inlineCallbacks, returnValue
114
115@@ -58,6 +58,7 @@
116 channel.basic_ack(delivery_tag=0, multiple=True)
117 yield channel.tx_commit()
118
119+ @skipBroker(QPID)
120 @inlineCallbacks
121 def test_auto_rollback(self):
122 """
123@@ -95,6 +96,7 @@
124 channel.basic_ack(delivery_tag=0, multiple=True)
125 yield channel.tx_commit()
126
127+ @skipBroker(QPID)
128 @inlineCallbacks
129 def test_rollback(self):
130 """
131
132=== modified file 'src/txamqp/testlib.py'
133--- src/txamqp/testlib.py 2009-02-11 22:28:45 +0000
134+++ src/txamqp/testlib.py 2009-06-10 12:38:18 +0000
135@@ -17,6 +17,9 @@
136 # under the License.
137 #
138
139+import os
140+import warnings
141+
142 from txamqp.content import Content
143 import txamqp.spec
144
145@@ -28,6 +31,27 @@
146 from twisted.python import failure
147 from txamqp.queue import Empty
148
149+
150+RABBITMQ = "RABBITMQ"
151+OPENAMQ = "OPENAMQ"
152+QPID = "QPID"
153+
154+
155+class skipBroker(object):
156+
157+ def __init__(self, *supporterBrokers):
158+ self.supporterBrokers = supporterBrokers
159+
160+ def __call__(self, f):
161+ if _get_broker() not in self.supporterBrokers:
162+ f.skip = "Not supported for this broker."
163+ return f
164+
165+
166+def _get_broker():
167+ return os.environ.get("TXAMQP_BROKER")
168+
169+
170 class TestBase(unittest.TestCase):
171
172 def __init__(self, *args, **kwargs):
173@@ -35,7 +59,22 @@
174
175 self.host = 'localhost'
176 self.port = 5672
177- self.spec = '../specs/qpid/amqp.0-8.xml'
178+ broker = _get_broker()
179+ if broker is None:
180+ warnings.warn(
181+ "Using default broker rabbitmq. Define TXAMQP_BROKER "
182+ "environment variable to customized it.")
183+ broker = RABBITMQ
184+ if broker == RABBITMQ:
185+ self.spec = '../specs/standard/amqp0-8.xml'
186+ elif broker == OPENAMQ:
187+ self.spec = '../specs/standard/amqp0-9.xml'
188+ elif broker == QPID:
189+ self.spec = '../specs/qpid/amqp.0-8.xml'
190+ else:
191+ raise RuntimeError(
192+ "Unsupported broker '%s'. Use one of RABBITMQ, OPENAMQ or "
193+ "QPID" % broker)
194 self.user = 'guest'
195 self.password = 'guest'
196 self.vhost = 'localhost'

Subscribers

People subscribed via source and target branches

to status/vote changes: