1- from typing import Any
1+ from typing import Any , Literal
22
33import pytest
44import structlog
@@ -19,27 +19,28 @@ class TestLabelsEndpoint:
1919 """Test class for the model catalog labels endpoint."""
2020
2121 @pytest .mark .smoke
22+ @pytest .mark .parametrize (
23+ "expected_labels_by_asset_type, asset_type" ,
24+ [
25+ pytest .param ("models" , "models" , id = "test_models" ),
26+ pytest .param ("mcp_servers" , "mcp_servers" , id = "test_mcp_servers" ),
27+ ],
28+ indirect = ["expected_labels_by_asset_type" ],
29+ )
2230 def test_labels_endpoint_default_data (
2331 self ,
24- admin_client : DynamicClient ,
25- model_registry_namespace : str ,
2632 model_catalog_rest_url : list [str ],
33+ expected_labels_by_asset_type : list [dict [str , Any ]],
34+ asset_type : Literal ["models" , "mcp_servers" ],
2735 ):
2836 """
2937 Smoke test: Validate default labels from ConfigMaps are returned by the endpoint.
3038 """
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
39+ LOGGER .info (f"Testing labels endpoint with default data for asset type: { asset_type } " )
3740 api_labels = get_labels_from_api (
38- model_catalog_rest_url = model_catalog_rest_url [0 ], user_token = get_openshift_token ()
41+ model_catalog_rest_url = model_catalog_rest_url [0 ], user_token = get_openshift_token (), asset_type = asset_type
3942 )
40-
41- # Verify they match
42- verify_labels_match (expected_labels = expected_labels , api_labels = api_labels )
43+ verify_labels_match (expected_labels = expected_labels_by_asset_type , api_labels = api_labels )
4344
4445 @pytest .mark .tier1
4546 def test_labels_endpoint_configmap_updates (
@@ -65,7 +66,7 @@ def _check_updated_labels():
6566
6667 # Split expected labels by asset type
6768 mcp_expected_labels = [label for label in all_expected_labels if label .get ("assetType" ) == "mcp_servers" ]
68- model_expected_labels = [label for label in all_expected_labels if label not in mcp_expected_labels ]
69+ model_expected_labels = [label for label in all_expected_labels if label . get ( "assetType" ) == "models" ]
6970
7071 # Verify default /labels returns only model labels (no MCP cross-contamination)
7172 api_labels = get_labels_from_api (model_catalog_rest_url = url , user_token = token )
0 commit comments