Skip to content

Commit 4fc79fa

Browse files
committed
done
1 parent cb1b719 commit 4fc79fa

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

services/autoscaling/tests/unit/conftest.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,38 @@ def hot_buffer_instance_type(app_settings: ApplicationSettings) -> InstanceTypeT
10341034
)
10351035

10361036

1037+
@pytest.fixture
1038+
def hot_buffer_has_pre_pull(
1039+
app_settings: ApplicationSettings,
1040+
hot_buffer_instance_type: InstanceTypeType,
1041+
) -> bool:
1042+
assert app_settings.AUTOSCALING_EC2_INSTANCES
1043+
return bool(
1044+
app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_COLD_START_DOCKER_IMAGES_PRE_PULLING
1045+
or app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_ALLOWED_TYPES[
1046+
hot_buffer_instance_type
1047+
].pre_pull_images
1048+
)
1049+
1050+
1051+
@pytest.fixture
1052+
def hot_buffer_expected_pre_pulled_images(
1053+
app_settings: ApplicationSettings,
1054+
hot_buffer_instance_type: InstanceTypeType,
1055+
) -> list[DockerGenericTag]:
1056+
assert app_settings.AUTOSCALING_EC2_INSTANCES
1057+
return sorted(
1058+
set(
1059+
app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_COLD_START_DOCKER_IMAGES_PRE_PULLING
1060+
)
1061+
| set(
1062+
app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_ALLOWED_TYPES[
1063+
hot_buffer_instance_type
1064+
].pre_pull_images
1065+
)
1066+
)
1067+
1068+
10371069
@pytest.fixture
10381070
def mock_find_node_with_name_returns_none(mocker: MockerFixture) -> Iterator[mock.Mock]:
10391071
return mocker.patch(

services/autoscaling/tests/unit/test_modules_cluster_scaling_dynamic.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ def minimal_configuration(
210210
mocked_ssm_server_envs: EnvVarsDict,
211211
enabled_dynamic_mode: EnvVarsDict,
212212
mocked_ec2_instances_envs: EnvVarsDict,
213+
with_ec2_instances_cold_start_docker_images_pre_pulling: EnvVarsDict,
213214
disabled_rabbitmq: None,
214215
disable_autoscaling_background_task: None,
215216
disable_buffers_pool_background_task: None,
@@ -342,30 +343,6 @@ async def test_cluster_scaling_with_no_services_does_nothing(
342343
)
343344

344345

345-
@pytest.fixture
346-
def hot_buffer_has_pre_pull(
347-
app_settings: ApplicationSettings,
348-
hot_buffer_instance_type: InstanceTypeType,
349-
) -> bool:
350-
assert app_settings.AUTOSCALING_EC2_INSTANCES
351-
return bool(
352-
app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_ALLOWED_TYPES[
353-
hot_buffer_instance_type
354-
].pre_pull_images
355-
)
356-
357-
358-
@pytest.fixture
359-
def hot_buffer_expected_pre_pulled_images(
360-
app_settings: ApplicationSettings,
361-
hot_buffer_instance_type: InstanceTypeType,
362-
) -> list[DockerGenericTag]:
363-
assert app_settings.AUTOSCALING_EC2_INSTANCES
364-
return app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_ALLOWED_TYPES[
365-
hot_buffer_instance_type
366-
].pre_pull_images
367-
368-
369346
@pytest.mark.parametrize(
370347
# NOTE: only the main test test_cluster_scaling_up_and_down is run with all options
371348
"with_docker_join_drained",

0 commit comments

Comments
 (0)