Skip to content

Commit

Permalink
Merge pull request #20 from innogames/l_ndco_3607
Browse files Browse the repository at this point in the history
Add support to cold_standby state
  • Loading branch information
TuxPowered42 authored Feb 7, 2024
2 parents 3be6d09 + 2dc9fa8 commit 25e7d5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lb_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ LbNodeAdminState admin_state_from_config(string s) {
return LbNodeAdminState::STATE_DRAIN_HARD;
if (s == "maintenance")
return LbNodeAdminState::STATE_DOWNTIME;
if (s == "cold_standby")
return LbNodeAdminState::STATE_DOWNTIME;
if (s == "retired")
return LbNodeAdminState::STATE_DOWNTIME;
return LbNodeAdminState::STATE_ENABLED;
Expand Down
12 changes: 12 additions & 0 deletions tests/lb_pool_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,18 @@ TEST_F(LbPoolTest, InitUpDowntimedMaintenance) {
EXPECT_EQ(UpNodesNames(), set<string>({"lbnode2", "lbnode3"}));
}

// Initial config loading in cold_standby state.
//
TEST_F(LbPoolTest, InitUpDowntimedColdStandby) {
base_config["lbpool.example.com"]["nodes"]["lbnode1"]["state"] =
"cold_standby";
SetUp(true);

EXPECT_EQ(UpNodesNames(), set<string>({"lbnode2", "lbnode3"}));
EndDummyHC(test_lb_pool, "lbnode1", HealthcheckResult::HC_PASS, true);
EXPECT_EQ(UpNodesNames(), set<string>({"lbnode2", "lbnode3"}));
}

// Initial config loading in draining state.
//
TEST_F(LbPoolTest, InitUpDowntimedDrain) {
Expand Down

0 comments on commit 25e7d5b

Please sign in to comment.