|
25 | 25 | get_activated_warm_buffer_ec2_tags, |
26 | 26 | get_deactivated_warm_buffer_ec2_tags, |
27 | 27 | is_warm_buffer_machine, |
| 28 | + list_pre_pulled_images_tag_keys, |
28 | 29 | load_pre_pulled_images_from_tags, |
29 | 30 | ) |
30 | 31 |
|
@@ -174,3 +175,53 @@ def test_dump_load_pre_pulled_images_as_tags( |
174 | 175 |
|
175 | 176 | def test_load_pre_pulled_images_as_tags_no_tag_present_returns_empty_list(faker: Faker): |
176 | 177 | assert load_pre_pulled_images_from_tags(faker.pydict(allowed_types=(str,))) == [] |
| 178 | + |
| 179 | + |
| 180 | +@pytest.mark.parametrize( |
| 181 | + "images, expected_tags", |
| 182 | + [ |
| 183 | + pytest.param( |
| 184 | + [ |
| 185 | + "itisfoundation/dynamic-sidecar:latest", |
| 186 | + "itisfoundation/agent:latest", |
| 187 | + "registry.pytest.com/simcore/services/dynamic/ti-postpro:2.0.34", |
| 188 | + "registry.pytest.com/simcore/services/dynamic/ti-simu:1.0.12", |
| 189 | + "registry.pytest.com/simcore/services/dynamic/ti-pers:1.0.19", |
| 190 | + "registry.pytest.com/simcore/services/dynamic/sim4life-postpro:2.0.106", |
| 191 | + "registry.pytest.com/simcore/services/dynamic/s4l-core-postpro:2.0.106", |
| 192 | + "registry.pytest.com/simcore/services/dynamic/s4l-core-stream:2.0.106", |
| 193 | + "registry.pytest.com/simcore/services/dynamic/sym-server-8-0-0-dy:2.0.106", |
| 194 | + "registry.pytest.com/simcore/services/dynamic/sim4life-8-0-0-modeling:3.2.34", |
| 195 | + "registry.pytest.com/simcore/services/dynamic/s4l-core-8-0-0-modeling:3.2.34", |
| 196 | + "registry.pytest.com/simcore/services/dynamic/s4l-stream-8-0-0-dy:3.2.34", |
| 197 | + "registry.pytest.com/simcore/services/dynamic/sym-server-8-0-0-dy:3.2.34", |
| 198 | + ], |
| 199 | + { |
| 200 | + f"{PRE_PULLED_IMAGES_EC2_TAG_KEY}_0": '["itisfoundation/dynamic-sidecar:latest","itisfoundation/agent:latest","registry.pytest.com/simcore/services/dynamic/ti-postpro:2.0.34","registry.pytest.com/simcore/services/dynamic/ti-simu:1.0.12","registry.pytest.com/simcore/services/dynamic/ti-pers:1.0.', |
| 201 | + f"{PRE_PULLED_IMAGES_EC2_TAG_KEY}_1": '19","registry.pytest.com/simcore/services/dynamic/sim4life-postpro:2.0.106","registry.pytest.com/simcore/services/dynamic/s4l-core-postpro:2.0.106","registry.pytest.com/simcore/services/dynamic/s4l-core-stream:2.0.106","registry.pytest.com/simcore/services', |
| 202 | + f"{PRE_PULLED_IMAGES_EC2_TAG_KEY}_2": '/dynamic/sym-server-8-0-0-dy:2.0.106","registry.pytest.com/simcore/services/dynamic/sim4life-8-0-0-modeling:3.2.34","registry.pytest.com/simcore/services/dynamic/s4l-core-8-0-0-modeling:3.2.34","registry.pytest.com/simcore/services/dynamic/s4l-stream-8-0-0', |
| 203 | + f"{PRE_PULLED_IMAGES_EC2_TAG_KEY}_3": '-dy:3.2.34","registry.pytest.com/simcore/services/dynamic/sym-server-8-0-0-dy:3.2.34"]', |
| 204 | + }, |
| 205 | + id="many images that get chunked to AWS Tag max length", |
| 206 | + ), |
| 207 | + pytest.param( |
| 208 | + ["itisfoundation/dynamic-sidecar:latest", "itisfoundation/agent:latest"], |
| 209 | + { |
| 210 | + PRE_PULLED_IMAGES_EC2_TAG_KEY: '["itisfoundation/dynamic-sidecar:latest","itisfoundation/agent:latest"]' |
| 211 | + }, |
| 212 | + id="<256 characters jsonized number of images does not get chunked", |
| 213 | + ), |
| 214 | + pytest.param( |
| 215 | + [], |
| 216 | + {PRE_PULLED_IMAGES_EC2_TAG_KEY: "[]"}, |
| 217 | + id="empty list", |
| 218 | + ), |
| 219 | + ], |
| 220 | +) |
| 221 | +def test_list_pre_pulled_images_tag_keys( |
| 222 | + images: list[DockerGenericTag], expected_tags: EC2Tags |
| 223 | +): |
| 224 | + assert dump_pre_pulled_images_as_tags(images) == expected_tags |
| 225 | + assert list_pre_pulled_images_tag_keys(expected_tags) == sorted( |
| 226 | + expected_tags.keys() |
| 227 | + ) |
0 commit comments