@@ -2648,43 +2648,61 @@ def initialize_console_logger_mock(mocker):
2648
2648
2649
2649
2650
2650
@pytest .mark .parametrize (
2651
- "current_replacing_nodes, node, instance, current_time, expected_result" ,
2651
+ "current_replacing_nodes, node, instance, current_time, max_count, expected_result" ,
2652
2652
[
2653
2653
(
2654
2654
set (),
2655
2655
StaticNode ("queue1-st-c5xlarge-1" , "ip-1" , "hostname" , "IDLE+CLOUD" , "queue1" ),
2656
2656
EC2Instance ("id-1" , "ip-1" , "hostname" , {"ip-1" }, datetime (2020 , 1 , 1 , 0 , 0 , 0 )),
2657
2657
datetime (2020 , 1 , 1 , 0 , 0 , 29 ),
2658
+ 0 ,
2658
2659
False ,
2659
2660
),
2660
2661
(
2661
2662
{"queue1-st-c5xlarge-1" },
2662
2663
StaticNode ("queue1-st-c5xlarge-1" , "ip-1" , "hostname" , "IDLE+CLOUD" , "queue1" ),
2663
2664
None ,
2664
2665
datetime (2020 , 1 , 1 , 0 , 0 , 29 ),
2666
+ 0 ,
2665
2667
False ,
2666
2668
),
2667
2669
(
2668
2670
{"queue1-st-c5xlarge-1" },
2669
2671
StaticNode ("queue1-st-c5xlarge-1" , "ip-1" , "hostname" , "DOWN+CLOUD" , "queue1" ),
2670
2672
EC2Instance ("id-1" , "ip-1" , "hostname" , {"ip-1" }, datetime (2020 , 1 , 1 , 0 , 0 , 0 )),
2671
2673
datetime (2020 , 1 , 1 , 0 , 0 , 29 ),
2674
+ 0 ,
2672
2675
True ,
2673
2676
),
2674
2677
(
2675
2678
{"queue1-st-c5xlarge-1" },
2676
2679
StaticNode ("queue1-st-c5xlarge-1" , "ip-1" , "hostname" , "IDLE+CLOUD" , "queue1" ),
2677
2680
EC2Instance ("id-1" , "ip-1" , "hostname" , {"ip-1" }, datetime (2020 , 1 , 1 , 0 , 0 , 0 )),
2678
2681
datetime (2020 , 1 , 1 , 0 , 0 , 30 ),
2682
+ 0 ,
2679
2683
False ,
2680
2684
),
2685
+ (
2686
+ {"queue1-st-c5xlarge-1" },
2687
+ StaticNode ("queue1-st-c5xlarge-1" , "ip-1" , "hostname" , "IDLE+CLOUD" , "queue1" ),
2688
+ None ,
2689
+ datetime (2020 , 1 , 1 , 0 , 0 , 30 ),
2690
+ 1 ,
2691
+ True ,
2692
+ ),
2693
+ ],
2694
+ ids = [
2695
+ "not_in_replacement" ,
2696
+ "no-backing-instance" ,
2697
+ "in_replacement" ,
2698
+ "timeout" ,
2699
+ "no-backing-instance-with-max-count" ,
2681
2700
],
2682
- ids = ["not_in_replacement" , "no-backing-instance" , "in_replacement" , "timeout" ],
2683
2701
)
2684
2702
@pytest .mark .usefixtures (
2685
2703
"initialize_instance_manager_mock" , "initialize_executor_mock" , "initialize_console_logger_mock"
2686
2704
)
2687
- def test_is_node_being_replaced (current_replacing_nodes , node , instance , current_time , expected_result ):
2705
+ def test_is_node_being_replaced (current_replacing_nodes , node , instance , current_time , max_count , expected_result ):
2688
2706
mock_sync_config = SimpleNamespace (
2689
2707
node_replacement_timeout = 30 ,
2690
2708
insufficient_capacity_timeout = 3 ,
@@ -2693,7 +2711,7 @@ def test_is_node_being_replaced(current_replacing_nodes, node, instance, current
2693
2711
region = "region" ,
2694
2712
boto3_config = None ,
2695
2713
fleet_config = {},
2696
- ec2_instance_missing_max_count = 0 ,
2714
+ ec2_instance_missing_max_count = max_count ,
2697
2715
)
2698
2716
cluster_manager = ClusterManager (mock_sync_config )
2699
2717
cluster_manager ._current_time = current_time
0 commit comments