|
1 | 1 | import pytest |
2 | 2 | import random |
| 3 | + |
| 4 | +import yaml |
3 | 5 | from kubernetes.dynamic import DynamicClient |
4 | 6 | from dictdiffer import diff |
5 | 7 | from ocp_resources.deployment import Deployment |
|
18 | 20 | validate_model_catalog_resource, |
19 | 21 | get_validate_default_model_catalog_source, |
20 | 22 | extract_schema_fields, |
21 | | - validate_model_catalog_configmap_data, |
| 23 | + validate_default_catalog, |
22 | 24 | ) |
23 | 25 | from tests.model_registry.utils import get_rest_headers, get_model_catalog_pod, execute_get_command |
24 | 26 | from utilities.user_utils import UserTestSession |
@@ -60,8 +62,16 @@ class TestModelCatalogGeneral: |
60 | 62 | ], |
61 | 63 | indirect=["model_catalog_config_map"], |
62 | 64 | ) |
63 | | - def test_config_map_exists(self: Self, model_catalog_config_map: ConfigMap, expected_catalogs: int): |
64 | | - validate_model_catalog_configmap_data(configmap=model_catalog_config_map, num_catalogs=expected_catalogs) |
| 65 | + def test_config_map_exists( |
| 66 | + self: Self, model_catalog_config_map: ConfigMap, expected_catalogs: int, validate_catalog: bool |
| 67 | + ) -> None: |
| 68 | + assert model_catalog_config_map.exists, f"{model_catalog_config_map.name} does not exist" |
| 69 | + catalogs = yaml.safe_load(model_catalog_config_map.instance.data["sources.yaml"])["catalogs"] |
| 70 | + assert len(catalogs) == expected_catalogs, ( |
| 71 | + f"{model_catalog_config_map.name} should have {expected_catalogs} catalog" |
| 72 | + ) |
| 73 | + if validate_catalog: |
| 74 | + validate_default_catalog(catalogs=catalogs) |
65 | 75 |
|
66 | 76 | @pytest.mark.parametrize( |
67 | 77 | "resource_name, expected_resource_count", |
|
0 commit comments