summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/cluster_tests.py
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-11-25 18:36:09 +0000
committerAlan Conway <aconway@apache.org>2009-11-25 18:36:09 +0000
commit8b804ca1645b09885ff2f3eb9a8540c842db92a2 (patch)
tree5bb06546d7a6ac7ac2a2a21d5649a774490eea79 /qpid/cpp/src/tests/cluster_tests.py
parent5f94901345298cea65cb2ab0b49b9ad721fc9cb3 (diff)
downloadqpid-python-8b804ca1645b09885ff2f3eb9a8540c842db92a2.tar.gz
Consistency checks for persistent cluster startup.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@884226 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/cluster_tests.py')
-rwxr-xr-xqpid/cpp/src/tests/cluster_tests.py49
1 files changed, 35 insertions, 14 deletions
diff --git a/qpid/cpp/src/tests/cluster_tests.py b/qpid/cpp/src/tests/cluster_tests.py
index 1437c9e20a..78967196a9 100755
--- a/qpid/cpp/src/tests/cluster_tests.py
+++ b/qpid/cpp/src/tests/cluster_tests.py
@@ -122,9 +122,9 @@ class StoreTests(BrokerTest):
def test_persistent_restart(self):
"""Verify persistent cluster shutdown/restart scenarios"""
cluster = self.cluster(0, args=self.args() + ["--cluster-size=3"])
- a = cluster.start("a", expect=EXPECT_EXIT_OK, wait_for_start=False)
- b = cluster.start("b", expect=EXPECT_EXIT_OK, wait_for_start=False)
- c = cluster.start("c", expect=EXPECT_EXIT_FAIL, wait_for_start=True)
+ a = cluster.start("a", expect=EXPECT_EXIT_OK, wait=False)
+ b = cluster.start("b", expect=EXPECT_EXIT_OK, wait=False)
+ c = cluster.start("c", expect=EXPECT_EXIT_FAIL, wait=True)
a.send_message("q", Message("1", durable=True))
# Kill & restart one member.
c.kill()
@@ -135,30 +135,30 @@ class StoreTests(BrokerTest):
# Shut down the entire cluster cleanly and bring it back up
a.send_message("q", Message("3", durable=True))
qpid_cluster.main(["qpid-cluster", "-kf", a.host_port()])
- a = cluster.start("a", wait_for_start=False)
- b = cluster.start("b", wait_for_start=False)
- c = cluster.start("c", wait_for_start=True)
+ a = cluster.start("a", wait=False)
+ b = cluster.start("b", wait=False)
+ c = cluster.start("c", wait=True)
self.assertEqual(a.get_message("q").content, "3")
def test_persistent_partial_failure(self):
# Kill 2 members, shut down the last cleanly then restart
# Ensure we use the clean database
cluster = self.cluster(0, args=self.args() + ["--cluster-size=3"])
- a = cluster.start("a", expect=EXPECT_EXIT_FAIL, wait_for_start=False)
- b = cluster.start("b", expect=EXPECT_EXIT_FAIL, wait_for_start=False)
- c = cluster.start("c", expect=EXPECT_EXIT_OK, wait_for_start=True)
+ a = cluster.start("a", expect=EXPECT_EXIT_FAIL, wait=False)
+ b = cluster.start("b", expect=EXPECT_EXIT_FAIL, wait=False)
+ c = cluster.start("c", expect=EXPECT_EXIT_OK, wait=True)
a.send_message("q", Message("4", durable=True))
a.kill()
b.kill()
self.assertEqual(c.get_message("q").content, "4")
c.send_message("q", Message("clean", durable=True))
qpid_cluster.main(["qpid-cluster", "-kf", c.host_port()])
- a = cluster.start("a", wait_for_start=False)
- b = cluster.start("b", wait_for_start=False)
- c = cluster.start("c", wait_for_start=True)
+ a = cluster.start("a", wait=False)
+ b = cluster.start("b", wait=False)
+ c = cluster.start("c", wait=True)
self.assertEqual(a.get_message("q").content, "clean")
- def test_wrong_store_uuid(self):
+ def test_wrong_cluster_id(self):
# Start a cluster1 broker, then try to restart in cluster2
cluster1 = self.cluster(0, args=self.args())
a = cluster1.start("a", expect=EXPECT_EXIT_OK)
@@ -168,4 +168,25 @@ class StoreTests(BrokerTest):
a = cluster2.start("a", expect=EXPECT_EXIT_FAIL)
self.fail("Expected exception")
except: pass
-
+
+ def test_wrong_shutdown_id(self):
+ # Start 2 members and shut down.
+ cluster = self.cluster(0, args=self.args()+["--cluster-size=2"])
+ a = cluster.start("a", expect=EXPECT_EXIT_OK, wait=False)
+ b = cluster.start("b", expect=EXPECT_EXIT_OK, wait=False)
+ self.assertEqual(0, qpid_cluster.main(["qpid_cluster", "-kf", a.host_port()]))
+ self.assertEqual(a.wait(), 0)
+ self.assertEqual(b.wait(), 0)
+
+ # Restart with a different member and shut down.
+ a = cluster.start("a", expect=EXPECT_EXIT_OK, wait=False)
+ c = cluster.start("c", expect=EXPECT_EXIT_OK, wait=False)
+ self.assertEqual(0, qpid_cluster.main(["qpid_cluster", "-kf", a.host_port()]))
+ self.assertEqual(a.wait(), 0)
+ self.assertEqual(c.wait(), 0)
+
+ # Mix members from both shutdown events, they should fail
+ a = cluster.start("a", expect=EXPECT_EXIT_FAIL, wait=False)
+ b = cluster.start("b", expect=EXPECT_EXIT_FAIL, wait=False)
+
+