|
28 | 28 | from pytest_simcore.helpers.logging_tools import log_context |
29 | 29 | from pytest_simcore.helpers.monkeypatch_envs import EnvVarsDict, setenvs_from_dict |
30 | 30 | from simcore_service_autoscaling.constants import PRE_PULLED_IMAGES_EC2_TAG_KEY |
31 | | -from simcore_service_autoscaling.modules.cluster_scaling._warm_buffer_machines_pool_core import ( |
32 | | - monitor_buffer_machines, |
33 | | -) |
34 | 31 | from simcore_service_autoscaling.modules.cluster_scaling._provider_dynamic import ( |
35 | 32 | DynamicAutoscalingProvider, |
36 | 33 | ) |
| 34 | +from simcore_service_autoscaling.modules.cluster_scaling._warm_buffer_machines_pool_core import ( |
| 35 | + monitor_buffer_machines, |
| 36 | +) |
37 | 37 | from types_aiobotocore_ec2 import EC2Client |
38 | 38 | from types_aiobotocore_ec2.literals import InstanceStateNameType, InstanceTypeType |
39 | 39 | from types_aiobotocore_ec2.type_defs import FilterTypeDef |
@@ -161,9 +161,9 @@ async def _test_monitor_buffer_machines( |
161 | 161 | ): |
162 | 162 | # 0. we have no instances now |
163 | 163 | all_instances = await ec2_client.describe_instances(Filters=instance_type_filters) |
164 | | - assert not all_instances["Reservations"], ( |
165 | | - f"There should be no instances at the start of the test. Found following instance ids: {[i['InstanceId'] for r in all_instances['Reservations'] if 'Instances' in r for i in r['Instances'] if 'InstanceId' in i]}" |
166 | | - ) |
| 164 | + assert not all_instances[ |
| 165 | + "Reservations" |
| 166 | + ], f"There should be no instances at the start of the test. Found following instance ids: {[i['InstanceId'] for r in all_instances['Reservations'] if 'Instances' in r for i in r['Instances'] if 'InstanceId' in i]}" |
167 | 167 |
|
168 | 168 | # 1. run, this will create as many buffer machines as needed |
169 | 169 | with log_context(logging.INFO, "create buffer machines"): |
@@ -388,9 +388,9 @@ async def test_monitor_buffer_machines_terminates_instances_with_incorrect_pre_p |
388 | 388 | ], |
389 | 389 | ): |
390 | 390 | # have machines of correct type with missing pre-pulled images |
391 | | - assert len(pre_pull_images) > 1, ( |
392 | | - "this test relies on pre-pulled images being filled with more than 1 image" |
393 | | - ) |
| 391 | + assert ( |
| 392 | + len(pre_pull_images) > 1 |
| 393 | + ), "this test relies on pre-pulled images being filled with more than 1 image" |
394 | 394 | buffer_machines = await create_buffer_machines( |
395 | 395 | buffer_count + 5, |
396 | 396 | next(iter(list(ec2_instances_allowed_types_with_only_1_buffered))), |
@@ -520,9 +520,9 @@ def pre_pull_images( |
520 | 520 | allowed_ec2_types.items(), |
521 | 521 | ) |
522 | 522 | ) |
523 | | - assert len(allowed_ec2_types_with_pre_pull_images_defined) <= 1, ( |
524 | | - "more than one type with pre-pulled-images is disallowed in this test!" |
525 | | - ) |
| 523 | + assert ( |
| 524 | + len(allowed_ec2_types_with_pre_pull_images_defined) <= 1 |
| 525 | + ), "more than one type with pre-pulled-images is disallowed in this test!" |
526 | 526 |
|
527 | 527 | if allowed_ec2_types_with_pre_pull_images_defined: |
528 | 528 | return next( |
|
0 commit comments