diff options
| author | Alan Conway <aconway@apache.org> | 2009-11-25 18:36:09 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2009-11-25 18:36:09 +0000 |
| commit | 3c1e695fe75391f8ed86c6ddbabed83220ecbd61 (patch) | |
| tree | 8421c735e04057e65b54bbc3f1cfdce5e21c23c5 /cpp/src/tests | |
| parent | 54852d1be662a49d6e97edd50785ffa0340b9ed7 (diff) | |
| download | qpid-python-3c1e695fe75391f8ed86c6ddbabed83220ecbd61.tar.gz | |
Consistency checks for persistent cluster startup.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@884226 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
| -rwxr-xr-x | cpp/src/tests/cluster_tests.py | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/cpp/src/tests/cluster_tests.py b/cpp/src/tests/cluster_tests.py index 1437c9e20a..78967196a9 100755 --- a/cpp/src/tests/cluster_tests.py +++ b/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) + + |
