summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/ha_test.py
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2013-08-01 20:27:39 +0000
committerAlan Conway <aconway@apache.org>2013-08-01 20:27:39 +0000
commit09ba98e9af327f339de442512a288190893f2c92 (patch)
tree82738a1e51cbf888eab5c497bd2fa1317a32515a /qpid/cpp/src/tests/ha_test.py
parent014f0f39d9cfb6242bea173eadbc0f8229ba5f7f (diff)
downloadqpid-python-09ba98e9af327f339de442512a288190893f2c92.tar.gz
QPID-4327: HA TX transactions, blocking wait for prepare
Backups send prepare messages to primary, primary delays completion of prepare till all are prepared (or there is a failure). This is NOT the production solution - blocking could cause a deadlock. We need to introduce asynchronous completion of prepare without blocking. This interim solution allows testing on other aspects of TX support. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1509424 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/ha_test.py')
-rwxr-xr-xqpid/cpp/src/tests/ha_test.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/qpid/cpp/src/tests/ha_test.py b/qpid/cpp/src/tests/ha_test.py
index 602a62ca17..cceb9795eb 100755
--- a/qpid/cpp/src/tests/ha_test.py
+++ b/qpid/cpp/src/tests/ha_test.py
@@ -265,16 +265,19 @@ acl allow all all
class HaCluster(object):
_cluster_count = 0
- def __init__(self, test, n, promote=True, wait=True, args=[], **kwargs):
+ def __init__(self, test, n, promote=True, wait=True, args=[], s_args=[], **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
+ @args: args for all brokers in the cluster.
+ @s_args: args for specific brokers: s_args[i] for broker i.
"""
self.test = test
self.args = args
+ self.s_args = s_args
self.kwargs = kwargs
self._ports = [HaPort(test) for i in xrange(n)]
self._set_url()
@@ -294,9 +297,12 @@ class HaCluster(object):
self.broker_id += 1
return name
- def _ha_broker(self, ha_port, name):
+ def _ha_broker(self, i, name):
+ args = self.args
+ if i < len(self.s_args): args += self.s_args[i]
+ ha_port = self._ports[i]
b = HaBroker(ha_port.test, ha_port, brokers_url=self.url, name=name,
- args=self.args, **self.kwargs)
+ args=args, **self.kwargs)
b.ready()
return b
@@ -308,7 +314,7 @@ class HaCluster(object):
self._ports.append(HaPort(self.test))
self._set_url()
self._update_urls()
- b = self._ha_broker(self._ports[i], self.next_name())
+ b = self._ha_broker(i, self.next_name())
self._brokers.append(b)
return b
@@ -334,7 +340,7 @@ class HaCluster(object):
a separate log file: foo.n.log"""
if self._ports[i].stopped: raise Exception("Restart after final kill: %s"%(self))
b = self._brokers[i]
- self._brokers[i] = self._ha_broker(self._ports[i], b.name)
+ self._brokers[i] = self._ha_broker(i, b.name)
self._brokers[i].ready()
def bounce(self, i, promote_next=True):