forked from opendatahub-io/opendatahub-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_verify_rhoai_images.py
More file actions
85 lines (77 loc) · 2.96 KB
/
test_verify_rhoai_images.py
File metadata and controls
85 lines (77 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"""
Tests to verify that all Model Registry component images (operator and instance container images)
meet the requirements:
1. Images are hosted in registry.redhat.io
2. Images use sha256 digest instead of tags
3. Images are listed in the CSV's relatedImages section
"""
from typing import Self
import pytest
from kubernetes.dynamic import DynamicClient
from ocp_resources.pod import Pod
from pytest_testconfig import config as py_config
from tests.model_registry.constants import MR_INSTANCE_NAME, MR_OPERATOR_NAME, MR_POSTGRES_DEPLOYMENT_NAME_STR
from tests.model_registry.image_validation.utils import validate_images
from utilities.constants import Labels
from utilities.opendatahub_logger import get_logger
LOGGER = get_logger(name=__name__)
pytestmark = [pytest.mark.downstream_only, pytest.mark.skip_must_gather]
class TestAIHubResourcesImages:
@pytest.mark.parametrize(
"resource_pods",
[
pytest.param(
{"namespace": py_config["model_registry_namespace"], "label_selector": "component=model-catalog"},
marks=pytest.mark.tier1,
id="test_model_catalog_pods_images",
),
pytest.param(
{
"namespace": py_config["applications_namespace"],
"label_selector": f"{Labels.OpenDataHubIo.NAME}={MR_OPERATOR_NAME}",
},
marks=pytest.mark.tier1,
id="test_model_registry_operator_pods_images",
),
],
indirect=True,
)
def test_verify_pod_images(
self: Self,
admin_client: DynamicClient,
resource_pods: list[Pod],
related_images_refs: set[str],
):
validate_images(pods_to_validate=resource_pods, related_images_refs=related_images_refs)
@pytest.mark.parametrize(
"model_registry_metadata_db_resources, model_registry_instance, model_registry_instance_pods_by_label",
[
pytest.param({}, {}, {"label_selectors": [f"app={MR_INSTANCE_NAME}"]}, marks=pytest.mark.smoke),
pytest.param(
{"db_name": "default"},
{"db_name": "default"},
{
"label_selectors": [
f"app.kubernetes.io/name={MR_INSTANCE_NAME}",
f"app.kubernetes.io/name={MR_POSTGRES_DEPLOYMENT_NAME_STR}",
]
},
marks=pytest.mark.tier2,
),
],
indirect=True,
)
@pytest.mark.usefixtures(
"updated_dsc_component_state_scope_session",
"model_registry_metadata_db_resources",
"model_registry_instance",
"model_registry_instance_pods_by_label",
)
class TestModelRegistryImages:
def test_verify_model_registry_pod_images(
self: Self,
admin_client: DynamicClient,
model_registry_instance_pods_by_label: list[Pod],
related_images_refs: set[str],
):
validate_images(pods_to_validate=model_registry_instance_pods_by_label, related_images_refs=related_images_refs)