summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/src/py/qpid_tests/broker_0_10/alternate_exchange.py4
-rw-r--r--tests/src/py/qpid_tests/broker_0_10/management.py4
-rw-r--r--tests/src/py/qpid_tests/broker_0_10/msg_groups.py2
-rw-r--r--tests/src/py/qpid_tests/broker_0_10/new_api.py4
-rw-r--r--tests/src/py/qpid_tests/broker_0_10/priority.py35
-rw-r--r--tests/src/py/qpid_tests/broker_0_10/threshold.py2
6 files changed, 29 insertions, 22 deletions
diff --git a/tests/src/py/qpid_tests/broker_0_10/alternate_exchange.py b/tests/src/py/qpid_tests/broker_0_10/alternate_exchange.py
index 8cbb5793d9..2e2d5de13a 100644
--- a/tests/src/py/qpid_tests/broker_0_10/alternate_exchange.py
+++ b/tests/src/py/qpid_tests/broker_0_10/alternate_exchange.py
@@ -308,8 +308,6 @@ class AlternateExchangeTests(TestBase010):
#create a queue using the intermediary as its alternate exchange:
session.queue_declare(queue="delivery-queue", alternate_exchange="my-exchange", auto_delete=True)
- #bind that queue to the dlq as well:
- session.exchange_bind(exchange="dlq", queue="delivery-queue")
#send it some messages:
dp=self.session.delivery_properties(routing_key="delivery-queue")
for m in ["One", "Two", "Three"]:
@@ -349,5 +347,5 @@ class AlternateExchangeTests(TestBase010):
def assertEmpty(self, queue):
try:
msg = queue.get(timeout=1)
- self.fail("Queue not empty: " + msg)
+ self.fail("Queue not empty: " + str(msg))
except Empty: None
diff --git a/tests/src/py/qpid_tests/broker_0_10/management.py b/tests/src/py/qpid_tests/broker_0_10/management.py
index a1316ea854..4ec3e0dd03 100644
--- a/tests/src/py/qpid_tests/broker_0_10/management.py
+++ b/tests/src/py/qpid_tests/broker_0_10/management.py
@@ -498,7 +498,7 @@ class ManagementTest (TestBase010):
session.queue_declare(queue="whatever", exclusive=True, auto_delete=True)
def test_immediate_method(self):
- url = "%s://%s:%d" % (self.broker.scheme or "amqp", self.broker.host, self.broker.port)
+ url = "%s://%s:%d" % (self.broker.scheme or "amqp", self.broker.host or "localhost", self.broker.port or 5672)
conn = qpid.messaging.Connection(url)
conn.open()
sess = conn.session()
@@ -659,7 +659,7 @@ class ManagementTest (TestBase010):
self.assertEqual(rc.receive, True)
# setup a connection & session to the broker
- url = "%s://%s:%d" % (self.broker.scheme or "amqp", self.broker.host, self.broker.port)
+ url = "%s://%s:%d" % (self.broker.scheme or "amqp", self.broker.host or "localhost", self.broker.port or 5672)
conn = qpid.messaging.Connection(url)
conn.open()
sess = conn.session()
diff --git a/tests/src/py/qpid_tests/broker_0_10/msg_groups.py b/tests/src/py/qpid_tests/broker_0_10/msg_groups.py
index ace7611a2f..ec015e1be4 100644
--- a/tests/src/py/qpid_tests/broker_0_10/msg_groups.py
+++ b/tests/src/py/qpid_tests/broker_0_10/msg_groups.py
@@ -787,7 +787,7 @@ class MultiConsumerMsgGroupTests(Base):
except Empty:
pass
assert count == 3 # non-A's
- assert a_count == 2 # pending acquired message included in browse results
+ assert a_count == 1 # assumes the acquired message was not the one purged and regular browsers don't get acquired messages
s1.acknowledge() # ack the consumed A-0
self.qmf_session.delBroker(self.qmf_broker)
diff --git a/tests/src/py/qpid_tests/broker_0_10/new_api.py b/tests/src/py/qpid_tests/broker_0_10/new_api.py
index 05c4815e57..18a13e3ddf 100644
--- a/tests/src/py/qpid_tests/broker_0_10/new_api.py
+++ b/tests/src/py/qpid_tests/broker_0_10/new_api.py
@@ -106,10 +106,10 @@ class GeneralTests(Base):
self.assertEqual(rx_alt.available(), 0, "No messages should have been routed to the alt_exchange")
- # Close sess1; This will cause the queue to be deleted
+ # Close sess1; This will cause the queue to be deleted and all its messages (including those acquired) to be reouted to the alternate exchange
sess1.close()
sleep(1)
- self.assertEqual(rx_alt.available(), 2, "2 of the messages should have been routed to the alt_exchange")
+ self.assertEqual(rx_alt.available(), 5, "All the messages should have been routed to the alt_exchange")
# Close sess2; This will cause the acquired messages to be requeued and routed to the alternate
sess2.close()
diff --git a/tests/src/py/qpid_tests/broker_0_10/priority.py b/tests/src/py/qpid_tests/broker_0_10/priority.py
index f99e908d76..bf4f1209b1 100644
--- a/tests/src/py/qpid_tests/broker_0_10/priority.py
+++ b/tests/src/py/qpid_tests/broker_0_10/priority.py
@@ -112,11 +112,11 @@ class PriorityTests (Base):
#check all messages on the queue were received by the browser; don't relay on any specific ordering at present
assert set([m.content for m in msgs]) == set([m.content for m in received])
- def ring_queue_check(self, msgs):
+ def ring_queue_check(self, msgs, count=10):
"""
Ensure that a ring queue removes lowest priority messages first.
"""
- snd = self.ssn.sender(address("priority-ring-queue", arguments="x-qpid-priorities:10, 'qpid.policy_type':ring, 'qpid.max_count':10"),
+ snd = self.ssn.sender(address("priority-ring-queue", arguments="x-qpid-priorities:10, 'qpid.policy_type':ring, 'qpid.max_count':%s" % count),
durable=self.durable())
for m in msgs: snd.send(m)
@@ -126,23 +126,31 @@ class PriorityTests (Base):
while True: received.append(rcv.fetch(0))
except Empty: None
- expected = []
- for m in msgs:
- while len(expected) > 9:
- expected=sorted_(expected, key=lambda x: priority_level(x.priority,10))
- expected.pop(0)
- expected.append(m)
- #print "sent %s; expected %s; got %s" % ([m.content for m in msgs], [m.content for m in expected], [m.content for m in received])
+ expected = sorted_(msgs, key=lambda x: priority_level(x.priority,10))[len(msgs)-count:]
+ expected = sorted_(expected, key=lambda x: priority_level(x.priority,10), reverse=True)
+ #print "sent %s; expected %s; got %s" % ([m.priority for m in msgs], [m.priority for m in expected], [m.priority for m in received])
+ #print "sent %s; expected %s; got %s" % ([m.content for m in msgs], [m.content for m in expected], [m.content for m in received])
assert [m.content for m in expected] == [m.content for m in received]
def test_ring_queue_1(self):
priorities = [4,5,3,6,9,9,2,9,2,9,9,1,9,9,9,3,3,3,9,9,3,9,3,9,9,9,9,9,9,2,3]
- seq = content("msg")
+ seq = content("msg")
self.ring_queue_check([Message(content=seq.next(), priority = p) for p in priorities])
def test_ring_queue_2(self):
- priorities = [9,0,2,3,6,9,9,2,9,2,9,9,1,9,4,7,1,1,3,9,9,3,9,3,9,9,9,1,9,9,2,3,0,9]
- seq = content("msg")
+ priorities = [9,0,2,3,6,3,4,2,9,2,9,9,1,9,4,7,1,1,3,9,7,3,9,3,9,1,5,1,9,7,2,3,0,9]
+ seq = content("msg")
+ self.ring_queue_check([Message(content=seq.next(), priority = p) for p in priorities])
+
+ def test_ring_queue_3(self):
+ #test case given for QPID-3866
+ priorities = [8,9,5,1,2,2,3,4,9,7,8,9,9,2]
+ seq = content("msg")
+ self.ring_queue_check([Message(content=seq.next(), priority = p) for p in priorities], 5)
+
+ def test_ring_queue_4(self):
+ priorities = [9,0,2,3,6,3,4,2,9,2,9,3,1,9,4,7,1,1,3,2,7,3,9,3,6,1,5,1,9,7,2,3,0,2]
+ seq = content("msg")
self.ring_queue_check([Message(content=seq.next(), priority = p) for p in priorities])
def test_requeue(self):
@@ -169,6 +177,7 @@ class PriorityTests (Base):
for expected in sorted_(msgs, key=lambda m: priority_level(m.priority,10), reverse=True):
msg = rcv.fetch(0)
#print "expected priority %s got %s" % (expected.priority, msg.priority)
+ #print "expected content %s got %s" % (expected.content, msg.content)
assert msg.content == expected.content
self.ssn.acknowledge(msg)
@@ -231,7 +240,7 @@ def sorted_(msgs, key=None, reverse=False):
Workaround lack of sorted builtin function in python 2.3 and lack
of keyword arguments to list.sort()
"""
- temp = msgs
+ temp = [m for m in msgs]
temp.sort(key_to_cmp(key, reverse=reverse))
return temp
diff --git a/tests/src/py/qpid_tests/broker_0_10/threshold.py b/tests/src/py/qpid_tests/broker_0_10/threshold.py
index 6628ae8424..0ad2295822 100644
--- a/tests/src/py/qpid_tests/broker_0_10/threshold.py
+++ b/tests/src/py/qpid_tests/broker_0_10/threshold.py
@@ -41,7 +41,7 @@ class ThresholdTests (Base):
snd.send(m)
count = count + 1
size = size + len(m.content)
- event = rcv.fetch()
+ event = rcv.fetch(timeout=1)
schema = event.content[0]["_schema_id"]
assert schema["_class_name"] == "queueThresholdExceeded"
values = event.content[0]["_values"]