summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/ha_test.py
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2013-01-31 19:37:12 +0000
committerAlan Conway <aconway@apache.org>2013-01-31 19:37:12 +0000
commit4d0d0d5cd7e040215e879a35fcb7ac7336c9c6df (patch)
tree3c255ef551766dafc63bdc0a0a8d1fc69a88af38 /qpid/cpp/src/tests/ha_test.py
parentdec50bd815c78de1c749fe8403238a43c1e5728f (diff)
downloadqpid-python-4d0d0d5cd7e040215e879a35fcb7ac7336c9c6df.tar.gz
QPID-4555: HA Test bugs causing sporadic faiulres in ha_tests.ReplicationTests.test_auto_delete_timeout
The tests were not waiting for the cluster to be ready before starting. Updated HaCluster to wait by default before returning. Increase timeout in calls to wait_no_queue, the default timeout of 1 sec was the same as the auto-delete timeout. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1441157 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/ha_test.py')
-rwxr-xr-xqpid/cpp/src/tests/ha_test.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/qpid/cpp/src/tests/ha_test.py b/qpid/cpp/src/tests/ha_test.py
index 4efbfdba3d..cdf9d3dd17 100755
--- a/qpid/cpp/src/tests/ha_test.py
+++ b/qpid/cpp/src/tests/ha_test.py
@@ -99,7 +99,8 @@ class HaBroker(Broker):
args = args + ["--sasl-mechanism", cred.mechanism]
self.qpid_ha_script.main_except(["", "-b", url]+args)
- def promote(self): self.ready(); self.qpid_ha(["promote"])
+ def promote(self):
+ self.ready(); self.qpid_ha(["promote"])
def set_public_url(self, url): self.qpid_ha(["set", "--public-url", url])
def set_brokers_url(self, url): self.qpid_ha(["set", "--brokers-url", url])
def replicate(self, from_broker, queue): self.qpid_ha(["replicate", from_broker, queue])
@@ -208,8 +209,14 @@ class HaBroker(Broker):
class HaCluster(object):
_cluster_count = 0
- def __init__(self, test, n, promote=True, **kwargs):
- """Start a cluster of n brokers"""
+ def __init__(self, test, n, promote=True, wait=True, **kwargs):
+ """Start a cluster of n brokers.
+
+ @test: The test being run
+ @n: start n brokers
+ @promote: promote self[0] to primary
+ @wait: wait for primary active and backups ready. Ignored if promote=False
+ """
self.test = test
self.kwargs = kwargs
self._brokers = []
@@ -218,7 +225,12 @@ class HaCluster(object):
HaCluster._cluster_count += 1
for i in xrange(n): self.start(False)
self.update_urls()
- if promote: self[0].promote()
+ if promote:
+ self[0].promote()
+ if wait:
+ self[0].wait_status("active")
+ for b in self[1:]: b.wait_status("ready")
+
def next_name(self):
name="cluster%s-%s"%(self.id, self.broker_id)