|
| 1 | +import filecmp |
| 2 | +import json |
1 | 3 | import os |
2 | 4 | import re |
3 | 5 | import subprocess |
4 | | -import botocore |
5 | | -import boto3 |
6 | | -import json |
7 | 6 | import time |
8 | | - |
9 | | -from packaging.version import Version |
10 | | -from packaging.specifiers import SpecifierSet |
11 | | - |
12 | | -import pytest |
13 | | -import requests |
14 | | -import filecmp |
15 | | - |
16 | | -from urllib3.util.retry import Retry |
17 | | -from invoke.context import Context |
18 | | -from botocore.exceptions import ClientError |
19 | | - |
20 | | -from src.buildspec import Buildspec |
21 | | -import src.utils as src_utils |
22 | 7 | from test.test_utils import ( |
23 | | - LOGGER, |
| 8 | + AL2023_BASE_DLAMI_ARM64_US_WEST_2, |
24 | 9 | CONTAINER_TESTS_PREFIX, |
| 10 | + LOGGER, |
| 11 | + DockerImagePullException, |
25 | 12 | ec2, |
| 13 | + execute_env_variables_test, |
| 14 | + get_account_id_from_image_uri, |
| 15 | + get_all_the_tags_of_an_image_from_ecr, |
| 16 | + get_buildspec_path, |
26 | 17 | get_container_name, |
| 18 | + get_cuda_version_from_tag, |
27 | 19 | get_framework_and_version_from_tag, |
28 | | - get_neuron_sdk_version_from_tag, |
| 20 | + get_image_spec_from_buildspec, |
| 21 | + get_installed_python_packages_using_image_uri, |
| 22 | + get_installed_python_packages_with_version, |
| 23 | + get_labels_from_ecr_image, |
29 | 24 | get_neuron_release_manifest, |
| 25 | + get_neuron_sdk_version_from_tag, |
| 26 | + get_python_version_from_image_uri, |
| 27 | + get_pytorch_version_from_autogluon_image, |
| 28 | + get_region_from_image_uri, |
| 29 | + get_repository_and_tag_from_image_uri, |
| 30 | + get_repository_local_path, |
30 | 31 | is_canary_context, |
31 | 32 | is_dlc_cicd_context, |
| 33 | + is_nightly_context, |
| 34 | + login_to_ecr_registry, |
32 | 35 | run_cmd_on_container, |
33 | 36 | start_container, |
34 | 37 | stop_and_remove_container, |
35 | | - get_repository_local_path, |
36 | | - get_repository_and_tag_from_image_uri, |
37 | | - get_python_version_from_image_uri, |
38 | | - get_pytorch_version_from_autogluon_image, |
39 | | - get_cuda_version_from_tag, |
40 | | - get_labels_from_ecr_image, |
41 | | - get_buildspec_path, |
42 | | - get_all_the_tags_of_an_image_from_ecr, |
43 | | - is_nightly_context, |
44 | | - execute_env_variables_test, |
45 | | - AL2023_BASE_DLAMI_ARM64_US_WEST_2, |
46 | | - get_installed_python_packages_with_version, |
47 | | - login_to_ecr_registry, |
48 | | - get_account_id_from_image_uri, |
49 | | - get_region_from_image_uri, |
50 | | - DockerImagePullException, |
51 | | - get_installed_python_packages_with_version, |
52 | | - get_installed_python_packages_using_image_uri, |
53 | | - get_image_spec_from_buildspec, |
54 | 38 | ) |
55 | 39 |
|
| 40 | +import boto3 |
| 41 | +import botocore |
| 42 | +import pytest |
| 43 | +import requests |
| 44 | +from botocore.exceptions import ClientError |
| 45 | +from invoke.context import Context |
| 46 | +from packaging.specifiers import SpecifierSet |
| 47 | +from packaging.version import Version |
| 48 | +from urllib3.util.retry import Retry |
| 49 | + |
| 50 | +import src.utils as src_utils |
| 51 | +from src.buildspec import Buildspec |
| 52 | + |
56 | 53 |
|
57 | 54 | def tail_n_lines(fname, n): |
58 | 55 | try: |
@@ -112,9 +109,10 @@ def test_stray_files(image): |
112 | 109 |
|
113 | 110 | :param image: ECR image URI |
114 | 111 | """ |
115 | | - if "vllm" in image: |
| 112 | + upstream_types = ["vllm", "sglang"] |
| 113 | + if any(t in image for t in upstream_types): |
116 | 114 | pytest.skip( |
117 | | - "vLLM images do not require pip check as they are managed by vLLM devs. Skipping test." |
| 115 | + f"{', '.join(upstream_types)} images do not require pip check as they are managed by upstream devs. Skipping test." |
118 | 116 | ) |
119 | 117 |
|
120 | 118 | ctx = Context() |
@@ -585,9 +583,10 @@ def test_pip_check(image): |
585 | 583 |
|
586 | 584 | :param image: ECR image URI |
587 | 585 | """ |
588 | | - if "vllm" in image: |
| 586 | + upstream_types = ["vllm", "sglang"] |
| 587 | + if any(t in image for t in upstream_types): |
589 | 588 | pytest.skip( |
590 | | - "vLLM images do not require pip check as they are managed by vLLM devs. Skipping test." |
| 589 | + f"{', '.join(upstream_types)} images do not require pip check as they are managed by upstream devs. Skipping test." |
591 | 590 | ) |
592 | 591 |
|
593 | 592 | allowed_exceptions = [] |
@@ -733,9 +732,10 @@ def test_cuda_paths(gpu): |
733 | 732 | :param gpu: gpu image uris |
734 | 733 | """ |
735 | 734 | image = gpu |
736 | | - if "base" in image or "vllm" in image: |
| 735 | + general_types = ["base", "vllm", "sglang"] |
| 736 | + if any(t in image for t in general_types): |
737 | 737 | pytest.skip( |
738 | | - "Base/vLLM DLC doesn't have the same directory structure and buildspec as other images" |
| 738 | + f"{', '.join(general_types)} DLC doesn't have the same directory structure and buildspec as other images" |
739 | 739 | ) |
740 | 740 | if "example" in image: |
741 | 741 | pytest.skip("Skipping Example Dockerfiles which are not explicitly tied to a cuda version") |
@@ -1070,8 +1070,9 @@ def test_license_file(image): |
1070 | 1070 | """ |
1071 | 1071 | Check that license file within the container is readable and valid |
1072 | 1072 | """ |
1073 | | - if "base" in image or "vllm" in image: |
1074 | | - pytest.skip("Base DLC has doesn't embed license.txt. Skipping test.") |
| 1073 | + general_types = ["base", "vllm", "sglang"] |
| 1074 | + if any(t in image for t in general_types): |
| 1075 | + pytest.skip(f"{', '.join(general_types)} DLC doesn't embed license.txt. Skipping test.") |
1075 | 1076 |
|
1076 | 1077 | framework, version = get_framework_and_version_from_tag(image) |
1077 | 1078 |
|
@@ -1194,8 +1195,10 @@ def test_core_package_version(image): |
1194 | 1195 | In this test, we ensure that if a core_packages.json file exists for an image, the packages installed in the image |
1195 | 1196 | satisfy the version constraints specified in the core_packages.json file. |
1196 | 1197 | """ |
1197 | | - if "base" in image or "vllm" in image: |
1198 | | - pytest.skip("Base/vLLM images do not have core packages. Skipping test.") |
| 1198 | + general_types = ["base", "vllm", "sglang"] |
| 1199 | + if any(t in image for t in general_types): |
| 1200 | + pytest.skip(f"{', '.join(general_types)} images do not have core packages. Skipping test.") |
| 1201 | + |
1199 | 1202 | core_packages_path = src_utils.get_core_packages_path(image) |
1200 | 1203 | if not os.path.exists(core_packages_path): |
1201 | 1204 | pytest.skip(f"Core packages file {core_packages_path} does not exist for {image}") |
|
0 commit comments