Merge lp:~therve/txamqp/fix-rabbit-failures into lp:txamqp

Proposed by Thomas Herve
Status: Merged
Approved by: Esteve Fernandez
Approved revision: 56
Merged at revision: 55
Proposed branch: lp:~therve/txamqp/fix-rabbit-failures
Merge into: lp:txamqp
Diff against target: 353 lines (+45/-39)
4 files modified
src/txamqp/test/test_basic.py (+29/-22)
src/txamqp/test/test_exchange.py (+2/-4)
src/txamqp/test/test_queue.py (+13/-12)
src/txamqp/testlib.py (+1/-1)
To merge this branch: bzr merge lp:~therve/txamqp/fix-rabbit-failures
Reviewer Review Type Date Requested Status
Esteve Fernandez Approve
Review via email: mp+38651@code.launchpad.net

Description of the change

So the branch mainly fixes the path to the spec file, but also skip a bunch of tests.

With those changes it's now green for me with the 2.1 release.

To post a comment you must log in.
Revision history for this message
Thomas Herve (therve) wrote :

I updated to make it work with 2.2.

56. By Thomas Herve

Skip some more tests

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

Sorry for the slow review. +1 It looks great! I think we should drop support for OpenAMQ, it's no longer maintained, but we can remove it in a later branch/ticket.

Thanks!

review: Approve

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 2010-01-16 06:39:33 +0000
3+++ src/txamqp/test/test_basic.py 2011-02-08 12:38:07 +0000
4@@ -6,9 +6,9 @@
5 # to you under the Apache License, Version 2.0 (the
6 # "License"); you may not use this file except in compliance
7 # with the License. You may obtain a copy of the License at
8-#
9+#
10 # http://www.apache.org/licenses/LICENSE-2.0
11-#
12+#
13 # Unless required by applicable law or agreed to in writing,
14 # software distributed under the License is distributed on an
15 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16@@ -71,7 +71,7 @@
17 except Closed, e:
18 self.assertChannelException(403, e.args[0])
19
20- #open new channel and cleanup last consumer:
21+ #open new channel and cleanup last consumer:
22 channel = yield self.client.channel(2)
23 yield channel.channel_open()
24
25@@ -84,9 +84,10 @@
26 self.assertChannelException(403, e.args[0])
27
28 @inlineCallbacks
29- def test_consume_queue_errors(self):
30+ def test_consume_queue_not_found(self):
31 """
32- Test error conditions associated with the queue field of the consume method:
33+ C{basic_consume} fails with a channel exception with a C{404} code when
34+ the specified queue doesn't exist.
35 """
36 channel = self.channel
37 try:
38@@ -96,8 +97,14 @@
39 except Closed, e:
40 self.assertChannelException(404, e.args[0])
41
42- channel = yield self.client.channel(2)
43- yield channel.channel_open()
44+ @supportedBrokers(QPID, OPENAMQ)
45+ @inlineCallbacks
46+ def test_consume_queue_unspecified(self):
47+ """
48+ C{basic_consume} fails with a connection exception with a C{503} code
49+ when no queue is specified.
50+ """
51+ channel = self.channel
52 try:
53 #queue not specified and none previously declared for channel:
54 yield channel.basic_consume(queue="")
55@@ -148,6 +155,7 @@
56 yield channel.basic_cancel(consumer_tag="my-consumer")
57 yield channel.basic_cancel(consumer_tag="this-never-existed")
58
59+ @supportedBrokers(QPID, OPENAMQ)
60 @inlineCallbacks
61 def test_ack(self):
62 """
63@@ -155,7 +163,7 @@
64 """
65 channel = self.channel
66 yield channel.queue_declare(queue="test-ack-queue", exclusive=True)
67-
68+
69 reply = yield channel.basic_consume(queue="test-ack-queue", no_ack=False)
70 queue = yield self.client.queue(reply.consumer_tag)
71
72@@ -164,13 +172,13 @@
73 channel.basic_publish(routing_key="test-ack-queue", content=Content("Three"))
74 channel.basic_publish(routing_key="test-ack-queue", content=Content("Four"))
75 channel.basic_publish(routing_key="test-ack-queue", content=Content("Five"))
76-
77+
78 msg1 = yield queue.get(timeout=1)
79 msg2 = yield queue.get(timeout=1)
80 msg3 = yield queue.get(timeout=1)
81 msg4 = yield queue.get(timeout=1)
82 msg5 = yield queue.get(timeout=1)
83-
84+
85 self.assertEqual("One", msg1.content.body)
86 self.assertEqual("Two", msg2.content.body)
87 self.assertEqual("Three", msg3.content.body)
88@@ -181,10 +189,10 @@
89 channel.basic_ack(delivery_tag=msg4.delivery_tag, multiple=False) #Four
90
91 yield channel.basic_recover(requeue=False)
92-
93+
94 msg3b = yield queue.get(timeout=1)
95 msg5b = yield queue.get(timeout=1)
96-
97+
98 self.assertEqual("Three", msg3b.content.body)
99 self.assertEqual("Five", msg5b.content.body)
100
101@@ -200,7 +208,7 @@
102 """
103 channel = self.channel
104 yield channel.queue_declare(queue="test-requeue", exclusive=True)
105-
106+
107 subscription = yield channel.basic_consume(queue="test-requeue", no_ack=False)
108 queue = yield self.client.queue(subscription.consumer_tag)
109
110@@ -209,13 +217,13 @@
111 channel.basic_publish(routing_key="test-requeue", content=Content("Three"))
112 channel.basic_publish(routing_key="test-requeue", content=Content("Four"))
113 channel.basic_publish(routing_key="test-requeue", content=Content("Five"))
114-
115+
116 msg1 = yield queue.get(timeout=1)
117 msg2 = yield queue.get(timeout=1)
118 msg3 = yield queue.get(timeout=1)
119 msg4 = yield queue.get(timeout=1)
120 msg5 = yield queue.get(timeout=1)
121-
122+
123 self.assertEqual("One", msg1.content.body)
124 self.assertEqual("Two", msg2.content.body)
125 self.assertEqual("Three", msg3.content.body)
126@@ -230,10 +238,10 @@
127 queue2 = yield self.client.queue(subscription2.consumer_tag)
128
129 yield channel.basic_recover(requeue=True)
130-
131+
132 msg3b = yield queue2.get()
133 msg5b = yield queue2.get()
134-
135+
136 self.assertEqual("Three", msg3b.content.body)
137 self.assertEqual("Five", msg5b.content.body)
138
139@@ -248,8 +256,7 @@
140 extra = yield queue.get(timeout=1)
141 self.fail("Got unexpected message in original queue: " + extra.content.body)
142 except Empty: None
143-
144- @supportedBrokers(QPID, OPENAMQ)
145+
146 @inlineCallbacks
147 def test_qos_prefetch_count(self):
148 """
149@@ -348,7 +355,7 @@
150 """
151 channel = self.channel
152 yield channel.queue_declare(queue="test-get", exclusive=True)
153-
154+
155 #publish some messages (no_ack=True) with persistent messaging
156 for i in range(1, 11):
157 msg=Content("Message %d" % i)
158@@ -401,7 +408,7 @@
159 self.assertEqual(reply.method.klass.name, "basic")
160 self.assertEqual(reply.method.name, "get-empty")
161
162- #public some messages (no_ack=False) with transient messaging
163+ #public some messages (no_ack=False) with transient messaging
164 for i in range(31, 41):
165 channel.basic_publish(routing_key="test-get", content=Content("Message %d" % i))
166
167@@ -421,7 +428,7 @@
168
169 #recover(requeue=True)
170 yield channel.basic_recover(requeue=True)
171-
172+
173 #get the unacked messages again (34, 36, 38, 40)
174 for i in [34, 36, 38, 40]:
175 reply = yield channel.basic_get(no_ack=False)
176
177=== modified file 'src/txamqp/test/test_exchange.py'
178--- src/txamqp/test/test_exchange.py 2010-01-16 06:39:33 +0000
179+++ src/txamqp/test/test_exchange.py 2011-02-08 12:38:07 +0000
180@@ -109,7 +109,6 @@
181 yield self.exchange_declare(0, exchange="t", type="topic")
182 yield self.verifyTopicExchange("t")
183
184- @supportedBrokers(QPID, OPENAMQ)
185 @inlineCallbacks
186 def testHeaders(self):
187 """Declare and test a headers exchange"""
188@@ -139,7 +138,6 @@
189 def testAmqTopic(self):
190 yield self.verifyTopicExchange("amq.topic")
191
192- @supportedBrokers(QPID, OPENAMQ)
193 @inlineCallbacks
194 def testAmqMatch(self):
195 yield self.verifyHeadersExchange("amq.match")
196@@ -154,6 +152,7 @@
197 routing key but without specifying the exchange name, then ensuring that
198 the message arrives in the queue correctly.
199 """
200+ @supportedBrokers(QPID, OPENAMQ)
201 @inlineCallbacks
202 def testDefaultExchange(self):
203 # Test automatic binding by queue name.
204@@ -301,7 +300,6 @@
205 def myBasicPublish(self, headers):
206 self.channel.basic_publish(exchange="amq.match", content=Content("foobar", properties={'headers':headers}))
207
208- @supportedBrokers(QPID, OPENAMQ)
209 @inlineCallbacks
210 def testMatchAll(self):
211 yield self.channel.queue_bind(queue="q", exchange="amq.match", arguments={ 'x-match':'all', "name":"fred", "age":3})
212@@ -315,7 +313,6 @@
213 self.myBasicPublish({"name":"fred", "age":2})
214 yield self.assertEmpty(self.q)
215
216- @supportedBrokers(QPID, OPENAMQ)
217 @inlineCallbacks
218 def testMatchAny(self):
219 yield self.channel.queue_bind(queue="q", exchange="amq.match", arguments={ 'x-match':'any', "name":"fred", "age":3})
220@@ -340,6 +337,7 @@
221 except Closed, e:
222 self.assertConnectionException(503, e.args[0])
223
224+ @supportedBrokers(QPID, OPENAMQ)
225 @inlineCallbacks
226 def testDifferentDeclaredType(self):
227 yield self.channel.exchange_declare(exchange="test_different_declared_type_exchange", type="direct")
228
229=== modified file 'src/txamqp/test/test_queue.py'
230--- src/txamqp/test/test_queue.py 2010-01-16 06:39:33 +0000
231+++ src/txamqp/test/test_queue.py 2011-02-08 12:38:07 +0000
232@@ -6,9 +6,9 @@
233 # to you under the Apache License, Version 2.0 (the
234 # "License"); you may not use this file except in compliance
235 # with the License. You may obtain a copy of the License at
236-#
237+#
238 # http://www.apache.org/licenses/LICENSE-2.0
239-#
240+#
241 # Unless required by applicable law or agreed to in writing,
242 # software distributed under the License is distributed on an
243 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
244@@ -18,13 +18,14 @@
245 #
246 from txamqp.client import Closed
247 from txamqp.content import Content
248-from txamqp.testlib import TestBase
249+from txamqp.testlib import TestBase, supportedBrokers, QPID, OPENAMQ
250
251 from twisted.internet.defer import inlineCallbacks
252
253 class QueueTests(TestBase):
254 """Tests for 'methods' on the amqp queue 'class'"""
255
256+ @supportedBrokers(QPID, OPENAMQ)
257 @inlineCallbacks
258 def test_purge(self):
259 """
260@@ -45,7 +46,7 @@
261
262 #now do the purge, then test that three messages are purged and the count drops to 0
263 reply = yield channel.queue_purge(queue="test-queue");
264- self.assertEqual(3, reply.message_count)
265+ self.assertEqual(3, reply.message_count)
266 reply = yield channel.queue_declare(queue="test-queue")
267 self.assertEqual(0, reply.message_count)
268
269@@ -56,7 +57,7 @@
270 msg = yield queue.get(timeout=1)
271 self.assertEqual("four", msg.content.body)
272
273- #check error conditions (use new channels):
274+ #check error conditions (use new channels):
275 channel = yield self.client.channel(2)
276 yield channel.channel_open()
277 try:
278@@ -75,7 +76,7 @@
279 except Closed, e:
280 self.assertConnectionException(530, e.args[0])
281
282- #cleanup
283+ #cleanup
284 other = yield self.connect()
285 channel = yield other.channel(1)
286 yield channel.channel_open()
287@@ -142,7 +143,7 @@
288 except Closed, e:
289 self.assertChannelException(404, e.args[0])
290
291- #need to reopen a channel:
292+ #need to reopen a channel:
293 channel = yield self.client.channel(2)
294 yield channel.channel_open()
295
296@@ -164,7 +165,7 @@
297 yield channel.queue_declare(queue="delete-me")
298 channel.basic_publish(routing_key="delete-me", content=Content("a"))
299 channel.basic_publish(routing_key="delete-me", content=Content("b"))
300- channel.basic_publish(routing_key="delete-me", content=Content("c"))
301+ channel.basic_publish(routing_key="delete-me", content=Content("c"))
302 reply = yield channel.queue_delete(queue="delete-me")
303 self.assertEqual(3, reply.message_count)
304 #check that it has gone be declaring passively
305@@ -174,7 +175,7 @@
306 except Closed, e:
307 self.assertChannelException(404, e.args[0])
308
309- #check attempted deletion of non-existant queue is handled correctly:
310+ #check attempted deletion of non-existant queue is handled correctly:
311 channel = yield self.client.channel(2)
312 yield channel.channel_open()
313 try:
314@@ -202,7 +203,7 @@
315 except Closed, e:
316 self.assertChannelException(406, e.args[0])
317
318- #need new channel now:
319+ #need new channel now:
320 channel = yield self.client.channel(2)
321 yield channel.channel_open()
322
323@@ -235,7 +236,7 @@
324 yield channel.queue_declare(queue="delete-me-3", passive="True")
325 reply = yield channel.basic_consume(queue="delete-me-3", no_ack=True)
326
327- #need new channel now:
328+ #need new channel now:
329 channel2 = yield self.client.channel(2)
330 yield channel2.channel_open()
331 #try to delete, but only if empty:
332@@ -246,7 +247,7 @@
333 self.assertChannelException(406, e.args[0])
334
335
336- yield channel.basic_cancel(consumer_tag=reply.consumer_tag)
337+ yield channel.basic_cancel(consumer_tag=reply.consumer_tag)
338 yield channel.queue_delete(queue="delete-me-3", if_unused="True")
339 #check that it has gone by declaring passively:
340 try:
341
342=== modified file 'src/txamqp/testlib.py'
343--- src/txamqp/testlib.py 2010-07-16 17:28:54 +0000
344+++ src/txamqp/testlib.py 2011-02-08 12:38:07 +0000
345@@ -73,7 +73,7 @@
346 "environment variable to customized it.")
347 self.broker = RABBITMQ
348 if self.broker == RABBITMQ:
349- self.spec = '../specs/rabbitmq/amqp0-8.stripped.xml'
350+ self.spec = '../specs/rabbitmq/amqp0-8.stripped.rabbitmq.xml'
351 elif self.broker == OPENAMQ:
352 self.spec = '../specs/standard/amqp0-9.stripped.xml'
353 elif self.broker == QPID:

Subscribers

People subscribed via source and target branches

to status/vote changes: