summaryrefslogtreecommitdiff
path: root/cpp/src/tests/ha_test.py
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-10-11 19:23:30 +0000
committerAlan Conway <aconway@apache.org>2012-10-11 19:23:30 +0000
commit0963c9f7a673b480cb26fc91215f48ddc5d7f769 (patch)
tree671688b468e37522d609de05a3dce06faeaad98b /cpp/src/tests/ha_test.py
parent7bc3da30bd8206d606620bc427e3d2d7a832e72e (diff)
downloadqpid-python-0963c9f7a673b480cb26fc91215f48ddc5d7f769.tar.gz
Bug 860701 - QPID-4350: HA handle auto-delete queues
Subscribed auto-delete queues are deleted by the backup. Timed auto-delete queues are deleted after the timeout. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1397243 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/ha_test.py')
-rwxr-xr-xcpp/src/tests/ha_test.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/cpp/src/tests/ha_test.py b/cpp/src/tests/ha_test.py
index 462c90bfb3..5cf28f6ef9 100755
--- a/cpp/src/tests/ha_test.py
+++ b/cpp/src/tests/ha_test.py
@@ -129,6 +129,16 @@ class HaBroker(Broker):
assert retry(try_get_status, timeout=20), "%s expected=%r, actual=%r"%(
self, status, self._status)
+ def wait_queue(self, queue, timeout=1):
+ """ Wait for queue to be visible via QMF"""
+ agent = self.agent()
+ assert retry(lambda: agent.getQueue(queue) is not None, timeout=timeout)
+
+ def wait_no_queue(self, queue, timeout=1):
+ """ Wait for queue to be invisible via QMF"""
+ agent = self.agent()
+ assert retry(lambda: agent.getQueue(queue) is None, timeout=timeout)
+
# FIXME aconway 2012-05-01: do direct python call to qpid-config code.
def qpid_config(self, args):
assert subprocess.call(
@@ -185,6 +195,9 @@ class HaBroker(Broker):
def ready(self):
return Broker.ready(self, client_properties={"qpid.ha-admin":1})
+ def kill(self):
+ self._agent = None
+ return Broker.kill(self)
class HaCluster(object):
_cluster_count = 0
@@ -225,7 +238,6 @@ class HaCluster(object):
def kill(self, i, promote_next=True):
"""Kill broker i, promote broker i+1"""
- self[i].expect = EXPECT_EXIT_FAIL
self[i].kill()
if promote_next: self[(i+1) % len(self)].promote()
@@ -254,12 +266,11 @@ class HaCluster(object):
def __getitem__(self,index): return self._brokers[index]
def __iter__(self): return self._brokers.__iter__()
+
def wait_address(session, address):
"""Wait for an address to become valid."""
def check():
- try:
- session.sender(address)
- return True
+ try: session.sender(address); return True
except NotFound: return False
assert retry(check), "Timed out waiting for address %s"%(address)
@@ -269,3 +280,5 @@ def valid_address(session, address):
session.receiver(address)
return True
except NotFound: return False
+
+