Skip to content

Commit b616ac0

Browse files
dbasunagclaude
andcommitted
fix: address review comments
Signed-off-by: Debarati Basu-Nag <[email protected]> Co-Authored-By: Claude <[email protected]>
1 parent affe2b2 commit b616ac0

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

tests/model_registry/model_catalog/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ def labels_configmap_patch(
374374
"name": "test-dynamic",
375375
"displayName": "Dynamic Test Label",
376376
"description": "A label added during test execution",
377+
"assetType": "models",
377378
},
378379
{
379380
"name": "mcp-test-label",

tests/model_registry/model_catalog/metadata/conftest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
@pytest.fixture()
1010
def expected_labels_by_asset_type(
11+
request: pytest.FixtureRequest,
1112
admin_client: DynamicClient,
1213
model_registry_namespace: str,
13-
) -> dict[str, list[dict[str, Any]]]:
14-
"""Get expected labels from ConfigMaps, split by asset type."""
14+
) -> list[dict[str, Any]]:
15+
"""Get expected labels from ConfigMaps, filtered by asset type from the test's parametrize."""
16+
asset_type = request.param
1517
all_labels = get_labels_from_configmaps(admin_client=admin_client, namespace=model_registry_namespace)
16-
mcp_labels = [label for label in all_labels if label.get("assetType") == "mcp_servers"]
17-
model_labels = [label for label in all_labels if label not in mcp_labels]
18-
return {"models": model_labels, "mcp_servers": mcp_labels}
18+
return [label for label in all_labels if label.get("assetType") == asset_type]

tests/model_registry/model_catalog/metadata/test_labels_endpoint.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ class TestLabelsEndpoint:
2020

2121
@pytest.mark.smoke
2222
@pytest.mark.parametrize(
23-
"asset_type",
23+
"expected_labels_by_asset_type, asset_type",
2424
[
25-
pytest.param("models", id="models"),
26-
pytest.param("mcp_servers", id="mcp_servers"),
25+
pytest.param("models", "models", id="test_models"),
26+
pytest.param("mcp_servers", "mcp_servers", id="test_mcp_servers"),
2727
],
28+
indirect=["expected_labels_by_asset_type"],
2829
)
2930
def test_labels_endpoint_default_data(
3031
self,
3132
model_catalog_rest_url: list[str],
32-
expected_labels_by_asset_type: dict[str, list[dict[str, Any]]],
33+
expected_labels_by_asset_type: list[dict[str, Any]],
3334
asset_type: Literal["models", "mcp_servers"],
3435
):
3536
"""
@@ -39,7 +40,7 @@ def test_labels_endpoint_default_data(
3940
api_labels = get_labels_from_api(
4041
model_catalog_rest_url=model_catalog_rest_url[0], user_token=get_openshift_token(), asset_type=asset_type
4142
)
42-
verify_labels_match(expected_labels=expected_labels_by_asset_type[asset_type], 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

Comments
 (0)