diff options
author | Alan Conway <aconway@apache.org> | 2009-11-18 17:26:43 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2009-11-18 17:26:43 +0000 |
commit | 1674d80b61862e1054140c96f5db9eb401b11f11 (patch) | |
tree | 1169853cb8f8376d7ebb078d28b2e76523302742 /cpp/src/tests/cluster_tests.py | |
parent | bd3cae3b5691436369b4c37a570c766c1e8aafd2 (diff) | |
download | qpid-python-1674d80b61862e1054140c96f5db9eb401b11f11.tar.gz |
Added cluster option --cluster-size.
--cluster-size=N means that during start-up the cluster waits to have N members
before accepting any clients.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@881839 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/cluster_tests.py')
-rwxr-xr-x | cpp/src/tests/cluster_tests.py | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/cpp/src/tests/cluster_tests.py b/cpp/src/tests/cluster_tests.py index 3ded6c103e..ed39277f77 100755 --- a/cpp/src/tests/cluster_tests.py +++ b/cpp/src/tests/cluster_tests.py @@ -26,13 +26,8 @@ from qpid.messaging import Message from threading import Thread -class ClusterTests(BrokerTest): - """Cluster tests with support for testing with a store plugin.""" - - def duration(self): - d = self.config.defines.get("DURATION") - if d: return float(d)*60 - else: return 3 +class ShortTests(BrokerTest): + """Short cluster functionality tests.""" def test_message_replication(self): """Test basic cluster message replication.""" @@ -57,6 +52,42 @@ class ClusterTests(BrokerTest): self.assertEqual("y", m.content) s2.connection.close() + def test_cluster_size(self): + """Verify cluster startup waits for N brokers if --cluster-size=N""" + class ConnectThread(Thread): + def __init__(self, broker): + Thread.__init__(self) + self.broker=broker + self.connected = False + self.error = None + + def run(self): + try: + self.broker.connect() + self.connected = True + except Exception, e: self.error = RethrownException(e) + + cluster = self.cluster(1, args=["--cluster-size=3"], wait_for_start=False) + c = ConnectThread(cluster[0]) + c.start() + time.sleep(.01) + assert not c.connected + cluster.start(wait_for_start=False) + time.sleep(.01) + assert not c.connected + cluster.start(wait_for_start=False) + c.join(1) + assert not c.isAlive() # Join didn't time out + assert c.connected + if c.error: raise c.error + +class LongTests(BrokerTest): + """Tests that can run for a long time if -DDURATION=<minutes> is set""" + def duration(self): + d = self.config.defines.get("DURATION") + if d: return float(d)*60 + else: return 3 # Default is to be quick + def test_failover(self): """Test fail-over during continuous send-receive with errors""" @@ -84,7 +115,8 @@ class ClusterTests(BrokerTest): receiver.stop(sender.sent) for i in range(i, len(cluster)): cluster[i].kill() -class ClusterStoreTests(BrokerTest): + +class StoreTests(BrokerTest): """ Cluster tests that can only be run if there is a store available. """ |