Merge lp://staging/~therve/txamqp/multiple-broker-testing into lp://staging/txamqp
- multiple-broker-testing
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp://staging/~therve/txamqp/multiple-broker-testing |
Merge into: | lp://staging/txamqp |
Diff against target: | None lines |
To merge this branch: | bzr merge lp://staging/~therve/txamqp/multiple-broker-testing |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Esteve Fernandez | Approve | ||
Review via email: mp+7280@code.staging.launchpad.net |
Commit message
Description of the change
Thomas Herve (therve) wrote : | # |
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?
Esteve Fernandez (esteve) : | # |
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!
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
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 | 19 | from txamqp.client import Closed | 19 | from txamqp.client import Closed |
6 | 20 | from txamqp.queue import Empty | 20 | from txamqp.queue import Empty |
7 | 21 | from txamqp.content import Content | 21 | from txamqp.content import Content |
9 | 22 | from txamqp.testlib import TestBase | 22 | from txamqp.testlib import TestBase, skipBroker, QPID |
10 | 23 | 23 | ||
11 | 24 | from twisted.internet.defer import inlineCallbacks | 24 | from twisted.internet.defer import inlineCallbacks |
12 | 25 | 25 | ||
13 | 26 | class BasicTests(TestBase): | 26 | class BasicTests(TestBase): |
14 | 27 | """Tests for 'methods' on the amqp basic 'class'""" | 27 | """Tests for 'methods' on the amqp basic 'class'""" |
15 | 28 | 28 | ||
16 | 29 | @skipBroker(QPID) | ||
17 | 29 | @inlineCallbacks | 30 | @inlineCallbacks |
18 | 30 | def test_consume_no_local(self): | 31 | def test_consume_no_local(self): |
19 | 31 | """ | 32 | """ |
20 | @@ -248,6 +249,7 @@ | |||
21 | 248 | self.fail("Got unexpected message in original queue: " + extra.content.body) | 249 | self.fail("Got unexpected message in original queue: " + extra.content.body) |
22 | 249 | except Empty: None | 250 | except Empty: None |
23 | 250 | 251 | ||
24 | 252 | @skipBroker(QPID) | ||
25 | 251 | @inlineCallbacks | 253 | @inlineCallbacks |
26 | 252 | def test_qos_prefetch_count(self): | 254 | def test_qos_prefetch_count(self): |
27 | 253 | """ | 255 | """ |
28 | @@ -289,6 +291,7 @@ | |||
29 | 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) |
30 | 290 | except Empty: None | 292 | except Empty: None |
31 | 291 | 293 | ||
32 | 294 | @skipBroker(QPID) | ||
33 | 292 | @inlineCallbacks | 295 | @inlineCallbacks |
34 | 293 | def test_qos_prefetch_size(self): | 296 | def test_qos_prefetch_size(self): |
35 | 294 | """ | 297 | """ |
36 | 295 | 298 | ||
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 | 19 | from txamqp.client import Closed | 19 | from txamqp.client import Closed |
42 | 20 | from txamqp.queue import Empty | 20 | from txamqp.queue import Empty |
43 | 21 | from txamqp.content import Content | 21 | from txamqp.content import Content |
45 | 22 | from txamqp.testlib import TestBase | 22 | from txamqp.testlib import TestBase, skipBroker, QPID |
46 | 23 | 23 | ||
47 | 24 | from twisted.internet.defer import inlineCallbacks | 24 | from twisted.internet.defer import inlineCallbacks |
48 | 25 | 25 | ||
49 | @@ -109,6 +109,7 @@ | |||
50 | 109 | except Closed, e: | 109 | except Closed, e: |
51 | 110 | self.assertConnectionException(504, e.args[0]) | 110 | self.assertConnectionException(504, e.args[0]) |
52 | 111 | 111 | ||
53 | 112 | @skipBroker(QPID) | ||
54 | 112 | @inlineCallbacks | 113 | @inlineCallbacks |
55 | 113 | def test_channel_flow(self): | 114 | def test_channel_flow(self): |
56 | 114 | channel = self.channel | 115 | channel = self.channel |
57 | 115 | 116 | ||
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 | 24 | """ | 24 | """ |
63 | 25 | 25 | ||
64 | 26 | from txamqp.queue import Empty | 26 | from txamqp.queue import Empty |
66 | 27 | from txamqp.testlib import TestBase | 27 | from txamqp.testlib import TestBase, skipBroker, QPID |
67 | 28 | from txamqp.content import Content | 28 | from txamqp.content import Content |
68 | 29 | from txamqp.client import Closed | 29 | from txamqp.client import Closed |
69 | 30 | 30 | ||
70 | @@ -109,6 +109,7 @@ | |||
71 | 109 | yield self.exchange_declare(0, exchange="t", type="topic") | 109 | yield self.exchange_declare(0, exchange="t", type="topic") |
72 | 110 | yield self.verifyTopicExchange("t") | 110 | yield self.verifyTopicExchange("t") |
73 | 111 | 111 | ||
74 | 112 | @skipBroker(QPID) | ||
75 | 112 | @inlineCallbacks | 113 | @inlineCallbacks |
76 | 113 | def testHeaders(self): | 114 | def testHeaders(self): |
77 | 114 | """Declare and test a headers exchange""" | 115 | """Declare and test a headers exchange""" |
78 | @@ -138,6 +139,7 @@ | |||
79 | 138 | def testAmqTopic(self): | 139 | def testAmqTopic(self): |
80 | 139 | yield self.verifyTopicExchange("amq.topic") | 140 | yield self.verifyTopicExchange("amq.topic") |
81 | 140 | 141 | ||
82 | 142 | @skipBroker(QPID) | ||
83 | 141 | @inlineCallbacks | 143 | @inlineCallbacks |
84 | 142 | def testAmqMatch(self): | 144 | def testAmqMatch(self): |
85 | 143 | yield self.verifyHeadersExchange("amq.match") | 145 | yield self.verifyHeadersExchange("amq.match") |
86 | @@ -299,6 +301,7 @@ | |||
87 | 299 | def myBasicPublish(self, headers): | 301 | def myBasicPublish(self, headers): |
88 | 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})) |
89 | 301 | 303 | ||
90 | 304 | @skipBroker(QPID) | ||
91 | 302 | @inlineCallbacks | 305 | @inlineCallbacks |
92 | 303 | def testMatchAll(self): | 306 | def testMatchAll(self): |
93 | 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}) |
94 | @@ -312,6 +315,7 @@ | |||
95 | 312 | self.myBasicPublish({"name":"fred", "age":2}) | 315 | self.myBasicPublish({"name":"fred", "age":2}) |
96 | 313 | yield self.assertEmpty(self.q) | 316 | yield self.assertEmpty(self.q) |
97 | 314 | 317 | ||
98 | 318 | @skipBroker(QPID) | ||
99 | 315 | @inlineCallbacks | 319 | @inlineCallbacks |
100 | 316 | def testMatchAny(self): | 320 | def testMatchAny(self): |
101 | 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}) |
102 | 318 | 322 | ||
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 | 19 | from txamqp.client import Closed | 19 | from txamqp.client import Closed |
108 | 20 | from txamqp.queue import Empty | 20 | from txamqp.queue import Empty |
109 | 21 | from txamqp.content import Content | 21 | from txamqp.content import Content |
111 | 22 | from txamqp.testlib import TestBase | 22 | from txamqp.testlib import TestBase, skipBroker, QPID |
112 | 23 | 23 | ||
113 | 24 | from twisted.internet.defer import inlineCallbacks, returnValue | 24 | from twisted.internet.defer import inlineCallbacks, returnValue |
114 | 25 | 25 | ||
115 | @@ -58,6 +58,7 @@ | |||
116 | 58 | channel.basic_ack(delivery_tag=0, multiple=True) | 58 | channel.basic_ack(delivery_tag=0, multiple=True) |
117 | 59 | yield channel.tx_commit() | 59 | yield channel.tx_commit() |
118 | 60 | 60 | ||
119 | 61 | @skipBroker(QPID) | ||
120 | 61 | @inlineCallbacks | 62 | @inlineCallbacks |
121 | 62 | def test_auto_rollback(self): | 63 | def test_auto_rollback(self): |
122 | 63 | """ | 64 | """ |
123 | @@ -95,6 +96,7 @@ | |||
124 | 95 | channel.basic_ack(delivery_tag=0, multiple=True) | 96 | channel.basic_ack(delivery_tag=0, multiple=True) |
125 | 96 | yield channel.tx_commit() | 97 | yield channel.tx_commit() |
126 | 97 | 98 | ||
127 | 99 | @skipBroker(QPID) | ||
128 | 98 | @inlineCallbacks | 100 | @inlineCallbacks |
129 | 99 | def test_rollback(self): | 101 | def test_rollback(self): |
130 | 100 | """ | 102 | """ |
131 | 101 | 103 | ||
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 | 17 | # under the License. | 17 | # under the License. |
137 | 18 | # | 18 | # |
138 | 19 | 19 | ||
139 | 20 | import os | ||
140 | 21 | import warnings | ||
141 | 22 | |||
142 | 20 | from txamqp.content import Content | 23 | from txamqp.content import Content |
143 | 21 | import txamqp.spec | 24 | import txamqp.spec |
144 | 22 | 25 | ||
145 | @@ -28,6 +31,27 @@ | |||
146 | 28 | from twisted.python import failure | 31 | from twisted.python import failure |
147 | 29 | from txamqp.queue import Empty | 32 | from txamqp.queue import Empty |
148 | 30 | 33 | ||
149 | 34 | |||
150 | 35 | RABBITMQ = "RABBITMQ" | ||
151 | 36 | OPENAMQ = "OPENAMQ" | ||
152 | 37 | QPID = "QPID" | ||
153 | 38 | |||
154 | 39 | |||
155 | 40 | class skipBroker(object): | ||
156 | 41 | |||
157 | 42 | def __init__(self, *supporterBrokers): | ||
158 | 43 | self.supporterBrokers = supporterBrokers | ||
159 | 44 | |||
160 | 45 | def __call__(self, f): | ||
161 | 46 | if _get_broker() not in self.supporterBrokers: | ||
162 | 47 | f.skip = "Not supported for this broker." | ||
163 | 48 | return f | ||
164 | 49 | |||
165 | 50 | |||
166 | 51 | def _get_broker(): | ||
167 | 52 | return os.environ.get("TXAMQP_BROKER") | ||
168 | 53 | |||
169 | 54 | |||
170 | 31 | class TestBase(unittest.TestCase): | 55 | class TestBase(unittest.TestCase): |
171 | 32 | 56 | ||
172 | 33 | def __init__(self, *args, **kwargs): | 57 | def __init__(self, *args, **kwargs): |
173 | @@ -35,7 +59,22 @@ | |||
174 | 35 | 59 | ||
175 | 36 | self.host = 'localhost' | 60 | self.host = 'localhost' |
176 | 37 | self.port = 5672 | 61 | self.port = 5672 |
178 | 38 | self.spec = '../specs/qpid/amqp.0-8.xml' | 62 | broker = _get_broker() |
179 | 63 | if broker is None: | ||
180 | 64 | warnings.warn( | ||
181 | 65 | "Using default broker rabbitmq. Define TXAMQP_BROKER " | ||
182 | 66 | "environment variable to customized it.") | ||
183 | 67 | broker = RABBITMQ | ||
184 | 68 | if broker == RABBITMQ: | ||
185 | 69 | self.spec = '../specs/standard/amqp0-8.xml' | ||
186 | 70 | elif broker == OPENAMQ: | ||
187 | 71 | self.spec = '../specs/standard/amqp0-9.xml' | ||
188 | 72 | elif broker == QPID: | ||
189 | 73 | self.spec = '../specs/qpid/amqp.0-8.xml' | ||
190 | 74 | else: | ||
191 | 75 | raise RuntimeError( | ||
192 | 76 | "Unsupported broker '%s'. Use one of RABBITMQ, OPENAMQ or " | ||
193 | 77 | "QPID" % broker) | ||
194 | 39 | self.user = 'guest' | 78 | self.user = 'guest' |
195 | 40 | self.password = 'guest' | 79 | self.password = 'guest' |
196 | 41 | self.vhost = 'localhost' | 80 | self.vhost = 'localhost' |
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.