Skip to content

Commit 9ad4e82

Browse files
authored
Merge branch 'main' into merge_sources
2 parents 6db6659 + e0194f9 commit 9ad4e82

31 files changed

+142
-250
lines changed

OWNERS

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
approvers:
2-
- <>
2+
- dbasunag
3+
- jgarciao
4+
- lugi0
35
reviewers:
4-
- <>
6+
- dbasunag
7+
- jgarciao
8+
- lugi0

tests/model_registry/model_catalog/catalog_config/test_default_model_catalog.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from ocp_resources.route import Route
1616
from ocp_resources.service import Service
1717

18-
from tests.model_registry.constants import DEFAULT_CUSTOM_MODEL_CATALOG, DEFAULT_MODEL_CATALOG_CM
18+
from tests.model_registry.constants import DEFAULT_MODEL_CATALOG_CM, DEFAULT_CUSTOM_MODEL_CATALOG
1919
from tests.model_registry.model_catalog.constants import REDHAT_AI_CATALOG_ID, CATALOG_CONTAINER, DEFAULT_CATALOGS
2020
from tests.model_registry.model_catalog.catalog_config.utils import (
2121
validate_model_catalog_enabled,
@@ -35,7 +35,6 @@
3535
"model_registry_namespace",
3636
"original_user",
3737
"test_idp_user",
38-
"enabled_model_catalog_config_map",
3938
)
4039
]
4140

@@ -47,7 +46,7 @@ class TestModelCatalogGeneral:
4746
[
4847
pytest.param(
4948
{"configmap_name": DEFAULT_CUSTOM_MODEL_CATALOG},
50-
2,
49+
0,
5150
False,
5251
id="test_model_catalog_sources_configmap_install",
5352
marks=pytest.mark.install,
@@ -168,7 +167,6 @@ class TestModelCatalogDefault:
168167
def test_model_catalog_default_catalog_sources(
169168
self,
170169
pytestconfig: pytest.Config,
171-
enabled_model_catalog_config_map: ConfigMap,
172170
test_idp_user: UserTestSession,
173171
model_catalog_rest_url: list[str],
174172
user_token_for_api_calls: str,
@@ -204,7 +202,6 @@ def test_model_catalog_default_catalog_sources(
204202

205203
def test_model_default_catalog_get_models_by_source(
206204
self: Self,
207-
enabled_model_catalog_config_map: ConfigMap,
208205
model_catalog_rest_url: list[str],
209206
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
210207
):
@@ -217,7 +214,6 @@ def test_model_default_catalog_get_models_by_source(
217214

218215
def test_model_default_catalog_get_model_by_name(
219216
self: Self,
220-
enabled_model_catalog_config_map: ConfigMap,
221217
model_catalog_rest_url: list[str],
222218
user_token_for_api_calls: str,
223219
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
@@ -235,7 +231,6 @@ def test_model_default_catalog_get_model_by_name(
235231

236232
def test_model_default_catalog_get_model_artifact(
237233
self: Self,
238-
enabled_model_catalog_config_map: ConfigMap,
239234
model_catalog_rest_url: list[str],
240235
user_token_for_api_calls: str,
241236
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
@@ -261,7 +256,6 @@ class TestModelCatalogDefaultData:
261256

262257
def test_model_default_catalog_number_of_models(
263258
self: Self,
264-
enabled_model_catalog_config_map: ConfigMap,
265259
default_catalog_api_response: dict[Any, Any],
266260
default_model_catalog_yaml_content: dict[Any, Any],
267261
):
@@ -278,7 +272,6 @@ def test_model_default_catalog_number_of_models(
278272

279273
def test_model_default_catalog_correspondence_of_model_name(
280274
self: Self,
281-
enabled_model_catalog_config_map: ConfigMap,
282275
default_catalog_api_response: dict[Any, Any],
283276
default_model_catalog_yaml_content: dict[Any, Any],
284277
catalog_openapi_schema: dict[Any, Any],
@@ -343,7 +336,6 @@ def test_model_default_catalog_correspondence_of_model_name(
343336

344337
def test_model_default_catalog_random_artifact(
345338
self: Self,
346-
enabled_model_catalog_config_map: ConfigMap,
347339
default_model_catalog_yaml_content: dict[Any, Any],
348340
model_catalog_rest_url: list[str],
349341
model_registry_rest_headers: dict[str, str],

tests/model_registry/model_catalog/conftest.py

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818
REDHAT_AI_CATALOG_ID,
1919
DEFAULT_CATALOGS,
2020
)
21-
from tests.model_registry.model_catalog.utils import get_models_from_catalog_api, get_catalog_url_and_headers
21+
from tests.model_registry.model_catalog.utils import get_models_from_catalog_api
2222
from tests.model_registry.constants import (
2323
CUSTOM_CATALOG_ID1,
24-
DEFAULT_MODEL_CATALOG_CM,
2524
DEFAULT_CUSTOM_MODEL_CATALOG,
2625
)
2726
from tests.model_registry.utils import (
@@ -39,57 +38,6 @@
3938
LOGGER = get_logger(name=__name__)
4039

4140

42-
@pytest.fixture(scope="session")
43-
def enabled_model_catalog_config_map(
44-
admin_client: DynamicClient,
45-
model_registry_namespace: str,
46-
current_client_token: str,
47-
) -> Generator[ConfigMap, None, None]:
48-
"""
49-
Enable all catalogs in the default model catalog configmap
50-
"""
51-
# Get operator-managed default sources ConfigMap
52-
default_sources_cm = ConfigMap(
53-
name=DEFAULT_MODEL_CATALOG_CM, client=admin_client, namespace=model_registry_namespace, ensure_exists=True
54-
)
55-
56-
# Get the sources.yaml content from default sources
57-
default_sources_yaml = default_sources_cm.instance.data.get("sources.yaml", "")
58-
59-
# Parse the YAML and extract only catalogs, enabling each one
60-
parsed_yaml = yaml.safe_load(default_sources_yaml)
61-
if not parsed_yaml or "catalogs" not in parsed_yaml:
62-
raise RuntimeError("No catalogs found in default sources ConfigMap")
63-
64-
for catalog in parsed_yaml["catalogs"]:
65-
catalog["enabled"] = True
66-
enabled_yaml_dict = {"catalogs": parsed_yaml["catalogs"]}
67-
enabled_sources_yaml = yaml.dump(enabled_yaml_dict, default_flow_style=False, sort_keys=False)
68-
69-
LOGGER.info("Adding enabled catalogs to model-catalog-sources ConfigMap")
70-
71-
# Get user-managed sources ConfigMap
72-
user_sources_cm = ConfigMap(
73-
name=DEFAULT_CUSTOM_MODEL_CATALOG, client=admin_client, namespace=model_registry_namespace, ensure_exists=True
74-
)
75-
76-
patches = {"data": {"sources.yaml": enabled_sources_yaml}}
77-
78-
with ResourceEditor(patches={user_sources_cm: patches}):
79-
# Wait for the model catalog pod to be ready
80-
is_model_catalog_ready(client=admin_client, model_registry_namespace=model_registry_namespace)
81-
82-
# Get the model catalog URL and headers and wait for the API to be fully ready
83-
catalog_url, headers = get_catalog_url_and_headers(
84-
admin_client=admin_client,
85-
model_registry_namespace=model_registry_namespace,
86-
token=current_client_token,
87-
)
88-
wait_for_model_catalog_api(url=catalog_url, headers=headers)
89-
90-
yield user_sources_cm
91-
92-
9341
@pytest.fixture(scope="class")
9442
def model_catalog_config_map(
9543
request: pytest.FixtureRequest, admin_client: DynamicClient, model_registry_namespace: str

tests/model_registry/model_catalog/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@
2525
"type": "yaml",
2626
"properties": {"yamlCatalogPath": "/shared-data/models-catalog.yaml"},
2727
"labels": [REDHAT_AI_CATALOG_NAME],
28+
"enabled": True,
2829
},
2930
"redhat_ai_validated_models": {
3031
"name": REDHAT_AI_VALIDATED_CATALOG_NAME,
3132
"type": "yaml",
3233
"properties": {"yamlCatalogPath": "/shared-data/validated-models-catalog.yaml"},
3334
"labels": [REDHAT_AI_VALIDATED_CATALOG_NAME],
35+
"enabled": True,
3436
},
3537
}
3638
REDHAT_AI_CATALOG_ID: str = "redhat_ai_models"

tests/model_registry/model_catalog/huggingface/test_huggingface_exclude_models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77

88
LOGGER = get_logger(name=__name__)
99

10-
pytestmark = [pytest.mark.usefixtures("updated_dsc_component_state_scope_session", "model_registry_namespace")]
10+
pytestmark = [
11+
pytest.mark.usefixtures("updated_dsc_component_state_scope_session", "model_registry_namespace"),
12+
pytest.mark.skip,
13+
]
1114

1215

1316
@pytest.mark.parametrize(

tests/model_registry/model_catalog/huggingface/test_huggingface_model_search.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
LOGGER = get_logger(name=__name__)
1010

11+
pytestmark = [pytest.mark.skip]
12+
1113

1214
@pytest.mark.parametrize(
1315
"updated_catalog_config_map, hf_model_name, source_filter",

tests/model_registry/model_catalog/huggingface/test_huggingface_model_sorting.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from tests.model_registry.model_catalog.sorting.utils import assert_model_sorting
66
from tests.model_registry.model_catalog.utils import get_hf_catalog_str
77

8+
pytestmark = [pytest.mark.skip]
9+
810

911
@pytest.mark.parametrize(
1012
"updated_catalog_config_map",

tests/model_registry/model_catalog/huggingface/test_huggingface_model_validation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313

1414
LOGGER = get_logger(name=__name__)
1515

16-
pytestmark = [pytest.mark.usefixtures("updated_dsc_component_state_scope_session", "model_registry_namespace")]
16+
pytestmark = [
17+
pytest.mark.usefixtures("updated_dsc_component_state_scope_session", "model_registry_namespace"),
18+
pytest.mark.skip,
19+
]
1720

1821

1922
@pytest.mark.parametrize(

tests/model_registry/model_catalog/metadata/test_catalog_preview.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class TestCatalogPreviewExistingSource:
2222

2323
@pytest.mark.parametrize("default_model_catalog_yaml_content", [VALIDATED_CATALOG_ID], indirect=True)
2424
@pytest.mark.usefixtures(
25-
"enabled_model_catalog_config_map",
2625
"model_registry_namespace",
2726
)
2827
def test_catalog_preview_included_and_excluded_models_filters(
@@ -82,7 +81,6 @@ def test_catalog_preview_included_and_excluded_models_filters(
8281

8382
@pytest.mark.parametrize("default_model_catalog_yaml_content", [VALIDATED_CATALOG_ID], indirect=True)
8483
@pytest.mark.usefixtures(
85-
"enabled_model_catalog_config_map",
8684
"model_registry_namespace",
8785
)
8886
def test_catalog_preview_no_filters(
@@ -130,7 +128,6 @@ def test_catalog_preview_no_filters(
130128

131129
@pytest.mark.parametrize("default_model_catalog_yaml_content", [VALIDATED_CATALOG_ID], indirect=True)
132130
@pytest.mark.usefixtures(
133-
"enabled_model_catalog_config_map",
134131
"model_registry_namespace",
135132
)
136133
@pytest.mark.parametrize(
@@ -241,7 +238,6 @@ class TestCatalogPreviewErrorHandling:
241238
],
242239
)
243240
@pytest.mark.usefixtures(
244-
"enabled_model_catalog_config_map",
245241
"model_registry_namespace",
246242
)
247243
def test_catalog_preview_invalid_config(
@@ -295,7 +291,6 @@ class TestCatalogPreviewUserProvidedData:
295291
"""
296292

297293
@pytest.mark.usefixtures(
298-
"enabled_model_catalog_config_map",
299294
"model_registry_namespace",
300295
)
301296
def test_catalog_preview_with_custom_catalog_data(

tests/model_registry/model_catalog/metadata/test_custom_properties.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
pytestmark = [
1919
pytest.mark.usefixtures(
2020
"updated_dsc_component_state_scope_session",
21-
"enabled_model_catalog_config_map",
2221
"model_registry_namespace",
2322
)
2423
]

0 commit comments

Comments
 (0)