@@ -308,7 +308,7 @@ async def test_cluster_scaling_with_no_services_does_nothing(
308308async def test_cluster_scaling_with_no_services_and_machine_buffer_starts_expected_machines (
309309 patch_ec2_client_launch_instances_min_number_of_instances : mock .Mock ,
310310 minimal_configuration : None ,
311- mock_machines_buffer : int ,
311+ with_instances_machines_hot_buffer : EnvVarsDict ,
312312 app_settings : ApplicationSettings ,
313313 initialized_app : FastAPI ,
314314 aws_allowed_ec2_instance_type_names_env : list [str ],
@@ -322,17 +322,13 @@ async def test_cluster_scaling_with_no_services_and_machine_buffer_starts_expect
322322 instance_type_filters : Sequence [FilterTypeDef ],
323323):
324324 assert app_settings .AUTOSCALING_EC2_INSTANCES
325- assert (
326- mock_machines_buffer
327- == app_settings .AUTOSCALING_EC2_INSTANCES .EC2_INSTANCES_MACHINES_BUFFER
328- )
329325 await auto_scale_cluster (
330326 app = initialized_app , auto_scaling_mode = DynamicAutoscaling ()
331327 )
332328 await assert_autoscaled_dynamic_ec2_instances (
333329 ec2_client ,
334330 expected_num_reservations = 1 ,
335- expected_num_instances = mock_machines_buffer ,
331+ expected_num_instances = app_settings . AUTOSCALING_EC2_INSTANCES . EC2_INSTANCES_MACHINES_BUFFER ,
336332 expected_instance_type = cast (
337333 InstanceTypeType ,
338334 next (
@@ -347,7 +343,7 @@ async def test_cluster_scaling_with_no_services_and_machine_buffer_starts_expect
347343 mock_rabbitmq_post_message ,
348344 app_settings ,
349345 initialized_app ,
350- instances_pending = mock_machines_buffer ,
346+ instances_pending = app_settings . AUTOSCALING_EC2_INSTANCES . EC2_INSTANCES_MACHINES_BUFFER ,
351347 )
352348 mock_rabbitmq_post_message .reset_mock ()
353349 # calling again should attach the new nodes to the reserve, but nothing should start
@@ -357,7 +353,7 @@ async def test_cluster_scaling_with_no_services_and_machine_buffer_starts_expect
357353 await assert_autoscaled_dynamic_ec2_instances (
358354 ec2_client ,
359355 expected_num_reservations = 1 ,
360- expected_num_instances = mock_machines_buffer ,
356+ expected_num_instances = app_settings . AUTOSCALING_EC2_INSTANCES . EC2_INSTANCES_MACHINES_BUFFER ,
361357 expected_instance_type = cast (
362358 InstanceTypeType ,
363359 next (
@@ -376,14 +372,15 @@ async def test_cluster_scaling_with_no_services_and_machine_buffer_starts_expect
376372 mock_rabbitmq_post_message ,
377373 app_settings ,
378374 initialized_app ,
379- nodes_total = mock_machines_buffer ,
380- nodes_drained = mock_machines_buffer ,
381- instances_running = mock_machines_buffer ,
375+ nodes_total = with_instances_machines_hot_buffer ,
376+ nodes_drained = with_instances_machines_hot_buffer ,
377+ instances_running = with_instances_machines_hot_buffer ,
382378 cluster_total_resources = {
383- "cpus" : mock_machines_buffer
379+ "cpus" : app_settings . AUTOSCALING_EC2_INSTANCES . EC2_INSTANCES_MACHINES_BUFFER
384380 * fake_node .description .resources .nano_cp_us
385381 / 1e9 ,
386- "ram" : mock_machines_buffer * fake_node .description .resources .memory_bytes ,
382+ "ram" : app_settings .AUTOSCALING_EC2_INSTANCES .EC2_INSTANCES_MACHINES_BUFFER
383+ * fake_node .description .resources .memory_bytes ,
387384 },
388385 )
389386
@@ -395,7 +392,7 @@ async def test_cluster_scaling_with_no_services_and_machine_buffer_starts_expect
395392 await assert_autoscaled_dynamic_ec2_instances (
396393 ec2_client ,
397394 expected_num_reservations = 1 ,
398- expected_num_instances = mock_machines_buffer ,
395+ expected_num_instances = app_settings . AUTOSCALING_EC2_INSTANCES . EC2_INSTANCES_MACHINES_BUFFER ,
399396 expected_instance_type = cast (
400397 InstanceTypeType ,
401398 next (
0 commit comments