Skip to content

Commit 565c711

Browse files
authored
fix: Remove x-fail due to RHOAIENG-49673 (#1129)
1 parent 106e3ec commit 565c711

2 files changed

Lines changed: 16 additions & 21 deletions

File tree

tests/model_registry/model_catalog/huggingface/test_huggingface_source_error_validation.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
from typing import Self
55

66
from ocp_resources.config_map import ConfigMap
7-
from tests.model_registry.model_catalog.utils import (
8-
assert_source_error_state_message,
9-
)
107
from tests.model_registry.model_catalog.huggingface.utils import assert_accessible_models_via_catalog_api
118
from tests.model_registry.utils import execute_get_command
129
from kubernetes.dynamic.exceptions import ResourceNotFoundError
@@ -38,6 +35,8 @@
3835
- "jonburdo/public-test-model-1"
3936
- "jonburdo/private-test-model-1"
4037
- "jonburdo/gated-test-model-1"
38+
labels:
39+
- {SOURCE_ID}
4140
"""
4241
},
4342
id="test_mixed_accessible_and_inaccessible_models",
@@ -52,7 +51,7 @@
5251
class TestHuggingFaceSourceErrorValidation:
5352
"""Test cases for RHOAIENG-47934 - Partial model fetching errors should not affect other models."""
5453

55-
def test_source_error_state_and_message(
54+
def test_source_state_and_message(
5655
self: Self,
5756
updated_catalog_config_map: ConfigMap,
5857
model_catalog_rest_url: list[str],
@@ -65,25 +64,24 @@ def test_source_error_state_and_message(
6564
1. The source is in error state due to private model fetch failure
6665
2. The error message contains the specific failed models
6766
"""
67+
LOGGER.info(f"Testing source state for source with failed models: {INACCESSIBLE_MODELS}")
6868
# Construct expected error message with failed models
69-
failed_models_str = ", ".join(INACCESSIBLE_MODELS)
7069
expected_error_message = (
7170
"Failed to fetch some models, ensure models exist and are accessible with "
72-
f"given credentials. Failed models: [{failed_models_str}]"
71+
f"given credentials. Failed models: [{', '.join(INACCESSIBLE_MODELS)}]"
7372
)
74-
75-
LOGGER.info(f"Testing source error state for failed models: {INACCESSIBLE_MODELS}")
76-
77-
assert_source_error_state_message(
78-
model_catalog_rest_url=model_catalog_rest_url,
79-
model_registry_rest_headers=model_registry_rest_headers,
80-
expected_error_message=expected_error_message,
81-
source_id=SOURCE_ID,
73+
results = execute_get_command(
74+
url=f"{model_catalog_rest_url[0]}sources",
75+
headers=model_registry_rest_headers,
76+
)["items"]
77+
# pick the relevant source first by id:
78+
matched_source = [result for result in results if result["id"] == SOURCE_ID]
79+
assert matched_source, f"Matched expected source not found: {results}"
80+
assert matched_source[0]["status"] == "partially-available"
81+
assert expected_error_message in matched_source[0]["error"], (
82+
f"Expected error: {expected_error_message} not found in {matched_source[0]['error']}"
8283
)
8384

84-
@pytest.mark.xfail(
85-
reason="RHOAIENG-49162: API call using source_label does not find models, when source is in error state"
86-
)
8785
def test_accessible_models_catalog_api_source_id(
8886
self: Self,
8987
updated_catalog_config_map: ConfigMap,

tests/model_registry/model_catalog/huggingface/utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import ast
22
from typing import Any
3-
import pytest
43

54
from simple_logger.logger import get_logger
65

@@ -235,6 +234,4 @@ def assert_accessible_models_via_catalog_api(
235234

236235
missing_models = [model for model in expected_accessible_models if model not in available_model_names]
237236

238-
if missing_models:
239-
LOGGER.error(f"Missing accessible models from catalog API: {missing_models}")
240-
pytest.fail(f"Missing accessible models from catalog API: {missing_models}")
237+
assert not missing_models, f"Missing accessible models from catalog API: {missing_models}"

0 commit comments

Comments
 (0)