Skip to content

Commit cf41615

Browse files
dbasunagclaude
andcommitted
fix: label tests needed update to accomodate mcp labels
Signed-off-by: Debarati Basu-Nag <dbasunag@redhat.com> Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c74eb5a commit cf41615

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tests/model_registry/model_catalog/metadata/test_labels_endpoint.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any
1+
from typing import Any, Literal
22

33
import pytest
44
import structlog
@@ -19,27 +19,27 @@ class TestLabelsEndpoint:
1919
"""Test class for the model catalog labels endpoint."""
2020

2121
@pytest.mark.smoke
22+
@pytest.mark.parametrize(
23+
"asset_type",
24+
[
25+
pytest.param("models", id="models"),
26+
pytest.param("mcp_servers", id="mcp_servers"),
27+
],
28+
)
2229
def test_labels_endpoint_default_data(
2330
self,
24-
admin_client: DynamicClient,
25-
model_registry_namespace: str,
2631
model_catalog_rest_url: list[str],
32+
expected_labels_by_asset_type: dict[str, list[dict[str, Any]]],
33+
asset_type: Literal["models", "mcp_servers"],
2734
):
2835
"""
2936
Smoke test: Validate default labels from ConfigMaps are returned by the endpoint.
3037
"""
31-
LOGGER.info("Testing labels endpoint with default data")
32-
33-
# Get expected labels from ConfigMaps
34-
expected_labels = get_labels_from_configmaps(admin_client=admin_client, namespace=model_registry_namespace)
35-
36-
# Get labels from API
38+
LOGGER.info(f"Testing labels endpoint with default data for asset type: {asset_type}")
3739
api_labels = get_labels_from_api(
38-
model_catalog_rest_url=model_catalog_rest_url[0], user_token=get_openshift_token()
40+
model_catalog_rest_url=model_catalog_rest_url[0], user_token=get_openshift_token(), asset_type=asset_type
3941
)
40-
41-
# Verify they match
42-
verify_labels_match(expected_labels=expected_labels, api_labels=api_labels)
42+
verify_labels_match(expected_labels=expected_labels_by_asset_type[asset_type], api_labels=api_labels)
4343

4444
@pytest.mark.tier1
4545
def test_labels_endpoint_configmap_updates(

0 commit comments

Comments
 (0)