@@ -294,3 +294,39 @@ TEST_F(LbPoolTest, InitUpDowntimedDrain) {
294
294
EndDummyHC (test_lb_pool, " lbnode1" , HealthcheckResult::HC_PASS, true );
295
295
EXPECT_EQ (UpNodesNames (), set<string>({" lbnode2" , " lbnode3" }));
296
296
}
297
+
298
+ // NDCO-4445: Force-up LB Nodes not added after downtime ends
299
+ // if they change state.
300
+ //
301
+ TEST_F (LbPoolTest, ForceUpDowntimedDrain) {
302
+ // Only one LB Node in this test.
303
+ base_config[" lbpool.example.com" ][" nodes" ].erase (" lbnode2" );
304
+ base_config[" lbpool.example.com" ][" nodes" ].erase (" lbnode3" );
305
+
306
+ base_config[" lbpool.example.com" ][" health_checks" ][0 ][" hc_max_failed" ] = 1 ;
307
+ base_config[" lbpool.example.com" ][" min_nodes" ] = 1 ;
308
+ base_config[" lbpool.example.com" ][" min_nodes_action" ] = " force_up" ;
309
+
310
+ SetUp (true );
311
+
312
+ // Start with an online, up LB Node.
313
+ EndDummyHC (test_lb_pool, " lbnode1" , HealthcheckResult::HC_PASS, true );
314
+ EXPECT_EQ (UpNodesNames (), set<string>({" lbnode1" }));
315
+
316
+ // Start a deployment.
317
+ GetLbNode (test_lb_pool, " lbnode1" )->change_downtime (" deploy_offline" );
318
+ EXPECT_EQ (UpNodesNames (), set<string>());
319
+
320
+ // Web server is stopped while the deployment is in progress.
321
+ EndDummyHC (test_lb_pool, " lbnode1" , HealthcheckResult::HC_FAIL, true );
322
+ EXPECT_EQ (UpNodesNames (), set<string>());
323
+
324
+ // The LB Node is set back to online before the deployment is finished.
325
+ // min_nodes_action is obeyed, the LB Node is added even though it's down.
326
+ GetLbNode (test_lb_pool, " lbnode1" )->change_downtime (" online" );
327
+ EXPECT_EQ (UpNodesNames (), set<string>({" lbnode1" }));
328
+
329
+ // The deployment is finished.
330
+ EndDummyHC (test_lb_pool, " lbnode1" , HealthcheckResult::HC_PASS, true );
331
+ EXPECT_EQ (UpNodesNames (), set<string>({" lbnode1" }));
332
+ }
0 commit comments