Skip to content

Commit 543194a

Browse files
authored
Minor changes to default catalog source (#690)
Signed-off-by: Debarati Basu-Nag <dbasunag@redhat.com>
1 parent a7b9a3a commit 543194a

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

tests/model_registry/model_catalog/conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ def catalog_config_map(admin_client: DynamicClient, model_registry_namespace: st
4141
return ConfigMap(name=DEFAULT_MODEL_CATALOG, client=admin_client, namespace=model_registry_namespace)
4242

4343

44+
@pytest.fixture(scope="class")
45+
def model_catalog_config_map(
46+
request: pytest.FixtureRequest, admin_client: DynamicClient, model_registry_namespace: str
47+
) -> ConfigMap:
48+
"""Parameterized fixture that takes a dict with configmap_name key and ensures it exists"""
49+
param = getattr(request, "param", {})
50+
configmap_name = param.get("configmap_name", "model-catalog-default-sources")
51+
return ConfigMap(name=configmap_name, client=admin_client, namespace=model_registry_namespace, ensure_exists=True)
52+
53+
4454
@pytest.fixture(scope="class")
4555
def model_catalog_routes(admin_client: DynamicClient, model_registry_namespace: str) -> list[Route]:
4656
return list(

tests/model_registry/model_catalog/test_default_model_catalog.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,26 @@
3434

3535
@pytest.mark.skip_must_gather
3636
class TestModelCatalogGeneral:
37-
@pytest.mark.post_upgrade
38-
def test_config_map_exists(self: Self, catalog_config_map: ConfigMap):
39-
# Check that the default configmaps is created when model registry is
37+
@pytest.mark.parametrize(
38+
"model_catalog_config_map",
39+
[
40+
pytest.param(
41+
{"configmap_name": "model-catalog-sources"},
42+
id="test_model_catalog_sources_configmap",
43+
),
44+
pytest.param(
45+
{"configmap_name": "model-catalog-default-sources"},
46+
id="test_model_catalog_default_sources_configmap",
47+
),
48+
],
49+
indirect=["model_catalog_config_map"],
50+
)
51+
def test_config_map_exists(self: Self, model_catalog_config_map: ConfigMap):
52+
# Check that model catalog configmaps is created when model registry is
4053
# enabled on data science cluster.
41-
assert catalog_config_map.exists, f"{catalog_config_map.name} does not exist"
42-
catalogs = yaml.safe_load(catalog_config_map.instance.data["sources.yaml"])["catalogs"]
54+
catalogs = yaml.safe_load(model_catalog_config_map.instance.data["sources.yaml"])["catalogs"]
4355
assert catalogs
44-
assert len(catalogs) == 1, f"{catalog_config_map.name} should have 1 catalog"
56+
assert len(catalogs) == 1, f"{model_catalog_config_map.name} should have 1 catalog"
4557
validate_default_catalog(default_catalog=catalogs[0])
4658

4759
@pytest.mark.parametrize(
@@ -65,7 +77,6 @@ def test_config_map_exists(self: Self, catalog_config_map: ConfigMap):
6577
),
6678
],
6779
)
68-
@pytest.mark.post_upgrade
6980
def test_model_catalog_resources_exists(
7081
self: Self, admin_client: DynamicClient, model_registry_namespace: str, resource_name: Any
7182
):

0 commit comments

Comments
 (0)