Skip to content

Commit 2faf1fe

Browse files
dbasunagfege
andauthored
Remove enabled_model_catalog_config_map fixture and it's usage (#1002)
* Remove enabled_model_catalog_config_map fixture and it's usage * test: remove catalog that are not the default one * test: skip test to include fix in a follow pr * test: skip because we need to disable the catalog source and this will be done later * fix: use the right marker --------- Co-authored-by: fege <fmosca@redhat.com>
1 parent 0f51317 commit 2faf1fe

17 files changed

+25
-143
lines changed

tests/model_registry/model_catalog/catalog_config/test_default_model_catalog.py

Lines changed: 1 addition & 23 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
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

@@ -45,20 +44,6 @@ class TestModelCatalogGeneral:
4544
@pytest.mark.parametrize(
4645
"model_catalog_config_map, expected_catalogs, validate_catalog",
4746
[
48-
pytest.param(
49-
{"configmap_name": DEFAULT_CUSTOM_MODEL_CATALOG},
50-
2,
51-
False,
52-
id="test_model_catalog_sources_configmap_install",
53-
marks=pytest.mark.install,
54-
),
55-
pytest.param(
56-
{"configmap_name": DEFAULT_CUSTOM_MODEL_CATALOG},
57-
1,
58-
False,
59-
id="test_model_catalog_sources_configmap_upgrade",
60-
marks=(pytest.mark.pre_upgrade, pytest.mark.post_upgrade),
61-
),
6247
pytest.param(
6348
{"configmap_name": DEFAULT_MODEL_CATALOG_CM},
6449
2,
@@ -168,7 +153,6 @@ class TestModelCatalogDefault:
168153
def test_model_catalog_default_catalog_sources(
169154
self,
170155
pytestconfig: pytest.Config,
171-
enabled_model_catalog_config_map: ConfigMap,
172156
test_idp_user: UserTestSession,
173157
model_catalog_rest_url: list[str],
174158
user_token_for_api_calls: str,
@@ -204,7 +188,6 @@ def test_model_catalog_default_catalog_sources(
204188

205189
def test_model_default_catalog_get_models_by_source(
206190
self: Self,
207-
enabled_model_catalog_config_map: ConfigMap,
208191
model_catalog_rest_url: list[str],
209192
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
210193
):
@@ -217,7 +200,6 @@ def test_model_default_catalog_get_models_by_source(
217200

218201
def test_model_default_catalog_get_model_by_name(
219202
self: Self,
220-
enabled_model_catalog_config_map: ConfigMap,
221203
model_catalog_rest_url: list[str],
222204
user_token_for_api_calls: str,
223205
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
@@ -235,7 +217,6 @@ def test_model_default_catalog_get_model_by_name(
235217

236218
def test_model_default_catalog_get_model_artifact(
237219
self: Self,
238-
enabled_model_catalog_config_map: ConfigMap,
239220
model_catalog_rest_url: list[str],
240221
user_token_for_api_calls: str,
241222
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
@@ -261,7 +242,6 @@ class TestModelCatalogDefaultData:
261242

262243
def test_model_default_catalog_number_of_models(
263244
self: Self,
264-
enabled_model_catalog_config_map: ConfigMap,
265245
default_catalog_api_response: dict[Any, Any],
266246
default_model_catalog_yaml_content: dict[Any, Any],
267247
):
@@ -278,7 +258,6 @@ def test_model_default_catalog_number_of_models(
278258

279259
def test_model_default_catalog_correspondence_of_model_name(
280260
self: Self,
281-
enabled_model_catalog_config_map: ConfigMap,
282261
default_catalog_api_response: dict[Any, Any],
283262
default_model_catalog_yaml_content: dict[Any, Any],
284263
catalog_openapi_schema: dict[Any, Any],
@@ -343,7 +322,6 @@ def test_model_default_catalog_correspondence_of_model_name(
343322

344323
def test_model_default_catalog_random_artifact(
345324
self: Self,
346-
enabled_model_catalog_config_map: ConfigMap,
347325
default_model_catalog_yaml_content: dict[Any, Any],
348326
model_catalog_rest_url: list[str],
349327
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
]

tests/model_registry/model_catalog/metadata/test_filter_options_endpoint.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22
from typing import Self
33
from simple_logger.logger import get_logger
4-
from ocp_resources.config_map import ConfigMap
54
from tests.model_registry.model_catalog.metadata.utils import (
65
validate_filter_options_structure,
76
compare_filter_options_with_database,
@@ -51,7 +50,6 @@ class TestFilterOptionsEndpoint:
5150
)
5251
def test_filter_options_endpoint_validation(
5352
self: Self,
54-
enabled_model_catalog_config_map: ConfigMap,
5553
model_catalog_rest_url: list[str],
5654
user_token_for_api_calls: str,
5755
test_idp_user: UserTestSession,
@@ -104,7 +102,6 @@ def test_filter_options_endpoint_validation(
104102
)
105103
def test_comprehensive_coverage_against_database(
106104
self: Self,
107-
enabled_model_catalog_config_map: ConfigMap,
108105
model_catalog_rest_url: list[str],
109106
user_token_for_api_calls: str,
110107
model_registry_namespace: str,
@@ -176,7 +173,6 @@ def test_comprehensive_coverage_against_database(
176173
)
177174
def test_named_queries_in_filter_options(
178175
self: Self,
179-
enabled_model_catalog_config_map: ConfigMap,
180176
model_catalog_rest_url: list[str],
181177
user_token_for_api_calls: str,
182178
test_idp_user: UserTestSession,

0 commit comments

Comments
 (0)