diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-11-23 21:12:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-23 21:12:52 +0100 |
commit | 6e7385e7858ee5491f028c7012d9928ea340d678 (patch) | |
tree | 20706e75771d68979fa5b6219f49791ed4dd4c8f /persistence/src/tests/spi/clusterstatetest.cpp | |
parent | a2f9a7b7d6afcd9e9567e53e5a0f489bddaf3cb4 (diff) | |
parent | 3d31f8967fc8970835b14a615f393ec4acda3394 (diff) |
Merge pull request #20156 from vespa-engine/vekterli/allow-searches-when-node-is-in-maintenance-mode
Continue serving search queries when in Maintenance node state [run-systemtest]
Diffstat (limited to 'persistence/src/tests/spi/clusterstatetest.cpp')
-rw-r--r-- | persistence/src/tests/spi/clusterstatetest.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/persistence/src/tests/spi/clusterstatetest.cpp b/persistence/src/tests/spi/clusterstatetest.cpp index 8a303c1a1ac..ac67903244f 100644 --- a/persistence/src/tests/spi/clusterstatetest.cpp +++ b/persistence/src/tests/spi/clusterstatetest.cpp @@ -233,4 +233,31 @@ TEST(ClusterStateTest, can_infer_own_node_retired_state) EXPECT_TRUE(!node_marked_as_retired_in_state("distributor:3 storage:3 .1.s:r", d, 0)); } +namespace { + +bool +node_marked_as_maintenance_in_state(const std::string& stateStr, + const lib::Distribution& d, + uint16_t node, + bool maintenance_in_all_spaces) +{ + lib::ClusterState s(stateStr); + ClusterState state(s, node, d, maintenance_in_all_spaces); + return state.nodeMaintenance(); +} + +} + +// We want to track the maintenance state for the _node_, not just the _bucket space_. +TEST(ClusterStateTest, node_maintenance_state_is_set_independent_of_bucket_space_state_string) +{ + lib::Distribution d(lib::Distribution::getDefaultDistributionConfig(3, 3)); + + // Note: it doesn't actually matter what the cluster state string itself says here + EXPECT_FALSE(node_marked_as_maintenance_in_state("distributor:3 storage:3", d, 0, false)); + EXPECT_TRUE(node_marked_as_maintenance_in_state("distributor:3 storage:3", d, 0, true)); + EXPECT_TRUE(node_marked_as_maintenance_in_state("distributor:3 storage:3 .0.s:d", d, 0, true)); + EXPECT_FALSE(node_marked_as_maintenance_in_state("distributor:3 storage:3 .0.s:m", d, 0, false)); +} + } |