summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-11-24 22:41:10 +0000
committerAlan Conway <aconway@apache.org>2009-11-24 22:41:10 +0000
commit40e40d3c5d3d3c6872d07f2e9071424cfc69ba91 (patch)
treeea601b8207e438812553b514d320a460348334f4 /qpid/cpp/src/tests
parentd65bec1539940b8d7f871d1bdd34719a2fdb9e64 (diff)
downloadqpid-python-40e40d3c5d3d3c6872d07f2e9071424cfc69ba91.tar.gz
Verify stored cluster-id matches agreed cluster-id when joining a persistent cluster.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@883910 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests')
-rw-r--r--qpid/cpp/src/tests/InitialStatusMap.cpp8
-rw-r--r--qpid/cpp/src/tests/StoreStatus.cpp40
-rwxr-xr-xqpid/cpp/src/tests/cluster_tests.py11
3 files changed, 34 insertions, 25 deletions
diff --git a/qpid/cpp/src/tests/InitialStatusMap.cpp b/qpid/cpp/src/tests/InitialStatusMap.cpp
index e6a3ec1620..82450eac22 100644
--- a/qpid/cpp/src/tests/InitialStatusMap.cpp
+++ b/qpid/cpp/src/tests/InitialStatusMap.cpp
@@ -37,17 +37,15 @@ QPID_AUTO_TEST_SUITE(InitialStatusMapTestSuite)
typedef InitialStatusMap::Status Status;
Status activeStatus(const Uuid& id=Uuid()) {
- return Status(ProtocolVersion(), 0, true, id,
- STORE_STATE_NO_STORE, Uuid(), Uuid());
+ return Status(ProtocolVersion(), 0, true, id, STORE_STATE_NO_STORE, Uuid());
}
Status newcomerStatus(const Uuid& id=Uuid()) {
- return Status(ProtocolVersion(), 0, false, id,
- STORE_STATE_NO_STORE, Uuid(), Uuid());
+ return Status(ProtocolVersion(), 0, false, id, STORE_STATE_NO_STORE, Uuid());
}
Status storeStatus(bool active, StoreState state, Uuid start=Uuid(), Uuid stop=Uuid()) {
- return Status(ProtocolVersion(), 0, active, Uuid(), state, start, stop);
+ return Status(ProtocolVersion(), 0, active, start, state, stop);
}
QPID_AUTO_TEST_CASE(testFirstInCluster) {
diff --git a/qpid/cpp/src/tests/StoreStatus.cpp b/qpid/cpp/src/tests/StoreStatus.cpp
index 37ba19e34a..153e4a33db 100644
--- a/qpid/cpp/src/tests/StoreStatus.cpp
+++ b/qpid/cpp/src/tests/StoreStatus.cpp
@@ -43,64 +43,64 @@ QPID_AUTO_TEST_CASE(testLoadEmpty) {
create_directory(TEST_DIR);
StoreStatus ss(TEST_DIR);
BOOST_CHECK_EQUAL(ss.getState(), STORE_STATE_NO_STORE);
- BOOST_CHECK(!ss.getStart());
- BOOST_CHECK(!ss.getStop());
+ BOOST_CHECK(!ss.getClusterId());
+ BOOST_CHECK(!ss.getShutdownId());
ss.load();
BOOST_CHECK_EQUAL(ss.getState(), STORE_STATE_EMPTY_STORE);
- BOOST_CHECK(!ss.getStop());
+ BOOST_CHECK(!ss.getShutdownId());
remove_all(TEST_DIR);
}
QPID_AUTO_TEST_CASE(testSaveLoadDirty) {
create_directory(TEST_DIR);
- Uuid start = Uuid(true);
+ Uuid clusterId = Uuid(true);
StoreStatus ss(TEST_DIR);
ss.load();
- ss.dirty(start);
+ ss.dirty(clusterId);
BOOST_CHECK_EQUAL(ss.getState(), STORE_STATE_DIRTY_STORE);
StoreStatus ss2(TEST_DIR);
ss2.load();
BOOST_CHECK_EQUAL(ss2.getState(), STORE_STATE_DIRTY_STORE);
- BOOST_CHECK_EQUAL(ss2.getStart(), start);
- BOOST_CHECK(!ss2.getStop());
+ BOOST_CHECK_EQUAL(ss2.getClusterId(), clusterId);
+ BOOST_CHECK(!ss2.getShutdownId());
remove_all(TEST_DIR);
}
QPID_AUTO_TEST_CASE(testSaveLoadClean) {
create_directory(TEST_DIR);
- Uuid start = Uuid(true);
- Uuid stop = Uuid(true);
+ Uuid clusterId = Uuid(true);
+ Uuid shutdownId = Uuid(true);
StoreStatus ss(TEST_DIR);
ss.load();
- ss.dirty(start);
- ss.clean(stop);
+ ss.dirty(clusterId);
+ ss.clean(shutdownId);
BOOST_CHECK_EQUAL(ss.getState(), STORE_STATE_CLEAN_STORE);
StoreStatus ss2(TEST_DIR);
ss2.load();
BOOST_CHECK_EQUAL(ss2.getState(), STORE_STATE_CLEAN_STORE);
- BOOST_CHECK_EQUAL(ss2.getStart(), start);
- BOOST_CHECK_EQUAL(ss2.getStop(), stop);
+ BOOST_CHECK_EQUAL(ss2.getClusterId(), clusterId);
+ BOOST_CHECK_EQUAL(ss2.getShutdownId(), shutdownId);
remove_all(TEST_DIR);
}
QPID_AUTO_TEST_CASE(testMarkDirty) {
// Save clean then mark to dirty.
create_directory(TEST_DIR);
- Uuid start = Uuid(true);
- Uuid stop = Uuid(true);
+ Uuid clusterId = Uuid(true);
+ Uuid shutdownId = Uuid(true);
StoreStatus ss(TEST_DIR);
ss.load();
- ss.dirty(start);
- ss.clean(stop);
- ss.dirty(start);
+ ss.dirty(clusterId);
+ ss.clean(shutdownId);
+ ss.dirty(clusterId);
StoreStatus ss2(TEST_DIR);
ss2.load();
BOOST_CHECK_EQUAL(ss2.getState(), STORE_STATE_DIRTY_STORE);
- BOOST_CHECK_EQUAL(ss2.getStart(), start);
- BOOST_CHECK(!ss2.getStop());
+ BOOST_CHECK_EQUAL(ss2.getClusterId(), clusterId);
+ BOOST_CHECK(!ss2.getShutdownId());
remove_all(TEST_DIR);
}
diff --git a/qpid/cpp/src/tests/cluster_tests.py b/qpid/cpp/src/tests/cluster_tests.py
index f3b71d700c..1437c9e20a 100755
--- a/qpid/cpp/src/tests/cluster_tests.py
+++ b/qpid/cpp/src/tests/cluster_tests.py
@@ -158,3 +158,14 @@ class StoreTests(BrokerTest):
c = cluster.start("c", wait_for_start=True)
self.assertEqual(a.get_message("q").content, "clean")
+ def test_wrong_store_uuid(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)
+ a.terminate()
+ cluster2 = self.cluster(1, args=self.args())
+ try:
+ a = cluster2.start("a", expect=EXPECT_EXIT_FAIL)
+ self.fail("Expected exception")
+ except: pass
+