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
53 lines (47 loc) · 1.76 KB
/
test_verify_rhoai_images.py
File metadata and controls
53 lines (47 loc) · 1.76 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
import pytest
from typing import Self, Set
from simple_logger.logger import get_logger
from kubernetes.dynamic import DynamicClient
from utilities.general import (
validate_container_images,
)
from ocp_resources.pod import Pod
from tests.model_registry.utils import get_model_catalog_pod
LOGGER = get_logger(name=__name__)
@pytest.mark.usefixtures(
"updated_dsc_component_state_scope_session",
"model_registry_namespace",
"model_registry_metadata_db_resources",
"model_registry_instance",
)
@pytest.mark.downstream_only
class TestModelRegistryImages:
"""
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
"""
@pytest.mark.smoke
@pytest.mark.skip_must_gather
def test_verify_model_registry_images(
self: Self,
admin_client: DynamicClient,
model_registry_operator_pod: Pod,
model_registry_instance_pod_by_label: Pod,
model_registry_namespace: str,
related_images_refs: Set[str],
):
model_catalog_pod = get_model_catalog_pod(
client=admin_client, model_registry_namespace=model_registry_namespace
)[0]
validation_errors = []
for pod in [model_registry_operator_pod, model_registry_instance_pod_by_label, model_catalog_pod]:
validation_errors.extend(
validate_container_images(
pod=pod, valid_image_refs=related_images_refs, skip_patterns=["openshift-service-mesh"]
)
)
if validation_errors:
pytest.fail("\n".join(validation_errors))