diff options
Diffstat (limited to 'vdslib/src/tests/state/clusterstatetest.cpp')
-rw-r--r-- | vdslib/src/tests/state/clusterstatetest.cpp | 82 |
1 files changed, 2 insertions, 80 deletions
diff --git a/vdslib/src/tests/state/clusterstatetest.cpp b/vdslib/src/tests/state/clusterstatetest.cpp index 143f3aed0e9..1880683232d 100644 --- a/vdslib/src/tests/state/clusterstatetest.cpp +++ b/vdslib/src/tests/state/clusterstatetest.cpp @@ -78,13 +78,6 @@ TEST(ClusterStateTest, test_basic_functionality) VERIFYNEW("storage:10 .1.s:i .2.s:u .3.s:d .4.s:m .5.s:r", "storage:10 .1.s:i .1.i:0 .3.s:d .4.s:m .5.s:r"); - // Test legal disk states - VERIFYNEW("storage:10 .1.d:4 .1.d.0.s:u .1.d.1.s:d", - "storage:10 .1.d:4 .1.d.1.s:d"); - - // Test other disk properties - VERIFYSAMENEW("storage:10 .1.d:4 .1.d.0.c:1.4"); - // Test other distributor node propertise // (Messages is excluded from system states to not make them too long as // most nodes have no use for them) @@ -143,20 +136,10 @@ TEST(ClusterStateTest, test_error_behaviour) // VERIFY_FAIL("distributor:4 .2.s:r", // "Retired is not a legal distributor state"); - // Test illegal storage states - VERIFY_FAIL("storage:4 .2.d:2 .2.d.5.s:d", "Cannot index disk 5 of 2"); - // Test blatantly illegal values for known attributes: VERIFY_FAIL("distributor:4 .2.s:z", "Unknown state z given.*"); VERIFY_FAIL("distributor:4 .2.i:foobar", ".*Init progress must be a floating point number from .*"); - VERIFY_FAIL("storage:4 .2.d:foobar", "Invalid disk count 'foobar'. Need.*"); - VERIFY_FAIL("storage:4 .2.d:2 .2.d.1.s:foobar", - "Unknown state foobar given.*"); - VERIFY_FAIL("storage:4 .2.d:2 .2.d.1.c:foobar", - "Illegal disk capacity 'foobar'. Capacity must be a .*"); - VERIFY_FAIL("storage:4 .2.d:2 .2.d.a.s:d", - "Invalid disk index 'a'. Need a positive integer .*"); // Lacking absolute path first VERIFY_FAIL(".2.s:d distributor:4", "The first path in system state.*"); @@ -168,34 +151,7 @@ TEST(ClusterStateTest, test_error_behaviour) VERIFYNEW("distributor:4 .2:foo storage:5 .4:d", "distributor:4 storage:5"); VERIFYNEW("ballalaika:true distributor:4 .2.urk:oj .2.z:foo .2.s:s " ".2.j:foo storage:10 .3.d:4 .3.d.2.a:boo .3.s:s", - "distributor:4 .2.s:s storage:10 .3.s:s .3.d:4"); -} - -TEST(ClusterStateTest, test_backwards_compability) -{ - // 4.1 and older nodes do not support some features, and the java parser - // do not allow unknown elements as it was supposed to do, thus we should - // avoid using new features when talking to 4.1 nodes. - - // - 4.1 nodes should not see new cluster, version, initializing and - // description tags. - VERIFYOLD("version:4 cluster:i storage:2 .0.s:i .0.i:0.5 .1.m:foobar", - "distributor:0 storage:2 .0.s:i"); - - // - 4.1 nodes have only one disk property being state, so in 4.1, a - // disk state is typically set as .4.d.2:d while in new format it - // specifies that this is the state .4.d.2.s:d - VERIFYSAMEOLD("distributor:0 storage:3 .2.d:10 .2.d.4:d"); - VERIFYOLD("distributor:0 storage:3 .2.d:10 .2.d.4.s:d", - "distributor:0 storage:3 .2.d:10 .2.d.4:d"); - - // - 4.1 nodes should always have distributor and storage tags with counts. - VERIFYOLD("storage:4", "distributor:0 storage:4"); - VERIFYOLD("distributor:4", "distributor:4 storage:0"); - - // - 4.1 nodes should not see the state stopping - VERIFYOLD("storage:4 .2.s:s", "distributor:0 storage:4 .2.s:d"); - + "distributor:4 .2.s:s storage:10 .3.s:s"); } TEST(ClusterStateTest, test_detailed) @@ -249,41 +205,7 @@ TEST(ClusterStateTest, test_detailed) } else { EXPECT_EQ(State::UP, ns.getState()); } - // Test disk states - if (i == 2) { - EXPECT_EQ(uint16_t(16), ns.getDiskCount()); - } else if (i == 8) { - EXPECT_EQ(uint16_t(10), ns.getDiskCount()); - } else { - EXPECT_EQ(uint16_t(0), ns.getDiskCount()); - } - if (i == 2) { - for (uint16_t j = 0; j < 16; ++j) { - if (j == 3) { - EXPECT_EQ(State::DOWN, - ns.getDiskState(j).getState()); - } else { - EXPECT_EQ(State::UP, - ns.getDiskState(j).getState()); - } - } - } else if (i == 8) { - for (uint16_t j = 0; j < 10; ++j) { - if (j == 4) { - EXPECT_DOUBLE_EQ(0.6, ns.getDiskState(j).getCapacity().getValue()); - EXPECT_EQ( - string("small"), - ns.getDiskState(j).getDescription()); - } else { - EXPECT_DOUBLE_EQ( - 1.0, ns.getDiskState(j).getCapacity().getValue()); - EXPECT_EQ( - string(""), - ns.getDiskState(j).getDescription()); - } - } - } - // Test message + // Test message if (i == 6) { EXPECT_EQ(string("bar\tfoo"), ns.getDescription()); } else { |