Skip to content

Commit 61518af

Browse files
committed
Remove enabled_model_catalog_config_map fixture and it's usage
1 parent 4592fa9 commit 61518af

12 files changed

+2
-126
lines changed

tests/model_registry/model_catalog/catalog_config/test_default_model_catalog.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"model_registry_namespace",
3636
"original_user",
3737
"test_idp_user",
38-
"enabled_model_catalog_config_map",
3938
)
4039
]
4140

@@ -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/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,

tests/model_registry/model_catalog/metadata/test_sources_endpoint.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import pytest
22

3-
from ocp_resources.config_map import ConfigMap
43
from simple_logger.logger import get_logger
54

65
from tests.model_registry.utils import execute_get_command
@@ -17,7 +16,6 @@ class TestSourcesEndpoint:
1716
@pytest.mark.smoke
1817
def test_available_source_status(
1918
self,
20-
enabled_model_catalog_config_map: ConfigMap,
2119
model_catalog_rest_url: list[str],
2220
model_registry_rest_headers: dict[str, str],
2321
):
@@ -41,7 +39,6 @@ def test_available_source_status(
4139
@pytest.mark.parametrize("disabled_catalog_source", ["redhat_ai_models"], indirect=True)
4240
def test_disabled_source_status(
4341
self,
44-
enabled_model_catalog_config_map: ConfigMap,
4542
disabled_catalog_source: str,
4643
model_catalog_rest_url: list[str],
4744
model_registry_rest_headers: dict[str, str],
@@ -79,7 +76,6 @@ def test_disabled_source_status(
7976
@pytest.mark.sanity
8077
def test_sources_endpoint_returns_all_sources_regardless_of_enabled_field(
8178
self,
82-
enabled_model_catalog_config_map: ConfigMap,
8379
disabled_catalog_source: str,
8480
model_catalog_rest_url: list[str],
8581
model_registry_rest_headers: dict[str, str],

tests/model_registry/model_catalog/search/test_model_artifact_search.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import random
44
from dictdiffer import diff
55

6-
from ocp_resources.config_map import ConfigMap
76
from tests.model_registry.model_catalog.search.utils import (
87
fetch_all_artifacts_with_dynamic_paging,
98
validate_model_artifacts_match_criteria_and,
@@ -53,7 +52,6 @@ class TestSearchArtifactsByFilterQuery:
5352
)
5453
def test_search_artifacts_by_invalid_filter_query(
5554
self: Self,
56-
enabled_model_catalog_config_map: ConfigMap,
5755
model_catalog_rest_url: list[str],
5856
model_registry_rest_headers: dict[str, str],
5957
randomly_picked_model_from_catalog_api_by_source: tuple[dict, str, str],
@@ -154,7 +152,6 @@ def test_search_artifacts_by_invalid_filter_query(
154152
)
155153
def test_filter_query_advanced_artifact_search(
156154
self: Self,
157-
enabled_model_catalog_config_map: ConfigMap,
158155
model_catalog_rest_url: list[str],
159156
model_registry_rest_headers: dict[str, str],
160157
randomly_picked_model_from_catalog_api_by_source: tuple[dict, str, str],
@@ -226,7 +223,6 @@ def test_filter_query_advanced_artifact_search(
226223
)
227224
def test_performance_artifacts_recommendations_parameter(
228225
self: Self,
229-
enabled_model_catalog_config_map: ConfigMap,
230226
model_catalog_rest_url: list[str],
231227
model_registry_rest_headers: dict[str, str],
232228
randomly_picked_model_from_catalog_api_by_source: tuple[dict, str, str],
@@ -293,7 +289,6 @@ class TestSearchModelArtifact:
293289
)
294290
def test_validate_model_artifacts_by_artifact_type(
295291
self: Self,
296-
enabled_model_catalog_config_map: ConfigMap,
297292
model_catalog_rest_url: list[str],
298293
model_registry_rest_headers: dict[str, str],
299294
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
@@ -359,7 +354,6 @@ def test_validate_model_artifacts_by_artifact_type(
359354
)
360355
def test_error_handled_for_invalid_artifact_type(
361356
self: Self,
362-
enabled_model_catalog_config_map: ConfigMap,
363357
model_catalog_rest_url: list[str],
364358
model_registry_rest_headers: dict[str, str],
365359
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
@@ -398,7 +392,6 @@ def test_error_handled_for_invalid_artifact_type(
398392
)
399393
def test_multiple_artifact_type_filtering(
400394
self: Self,
401-
enabled_model_catalog_config_map: ConfigMap,
402395
model_catalog_rest_url: list[str],
403396
model_registry_rest_headers: dict[str, str],
404397
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],

tests/model_registry/model_catalog/search/test_model_search.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import pytest
22
from dictdiffer import diff
3-
from ocp_resources.config_map import ConfigMap
43
from simple_logger.logger import get_logger
54
from typing import Self, Any
65
from tests.model_registry.model_catalog.constants import (
@@ -31,7 +30,6 @@ class TestSearchModelCatalog:
3130
@pytest.mark.smoke
3231
def test_search_model_catalog_source_label(
3332
self: Self,
34-
enabled_model_catalog_config_map: ConfigMap,
3533
model_catalog_rest_url: list[str],
3634
model_registry_rest_headers: dict[str, str],
3735
):
@@ -64,7 +62,6 @@ def test_search_model_catalog_source_label(
6462

6563
def test_search_model_catalog_invalid_source_label(
6664
self: Self,
67-
enabled_model_catalog_config_map: ConfigMap,
6865
model_catalog_rest_url: list[str],
6966
model_registry_rest_headers: dict[str, str],
7067
):
@@ -107,7 +104,6 @@ def test_search_model_catalog_invalid_source_label(
107104
)
108105
def test_search_model_catalog_match(
109106
self: Self,
110-
enabled_model_catalog_config_map: ConfigMap,
111107
model_catalog_rest_url: list[str],
112108
model_registry_rest_headers: dict[str, str],
113109
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
@@ -149,7 +145,6 @@ class TestSearchModelCatalogQParameter:
149145
)
150146
def test_q_parameter_basic_search(
151147
self: Self,
152-
enabled_model_catalog_config_map: ConfigMap,
153148
search_term: str,
154149
model_catalog_rest_url: list[str],
155150
model_registry_rest_headers: dict[str, str],
@@ -189,7 +184,6 @@ def test_q_parameter_basic_search(
189184
)
190185
def test_q_parameter_case_insensitive(
191186
self: Self,
192-
enabled_model_catalog_config_map: ConfigMap,
193187
search_term: str,
194188
case_variant: str,
195189
model_catalog_rest_url: list[str],
@@ -240,7 +234,6 @@ def test_q_parameter_case_insensitive(
240234

241235
def test_q_parameter_no_results(
242236
self: Self,
243-
enabled_model_catalog_config_map: ConfigMap,
244237
model_catalog_rest_url: list[str],
245238
model_registry_rest_headers: dict[str, str],
246239
model_registry_namespace: str,
@@ -270,7 +263,6 @@ def test_q_parameter_no_results(
270263
def test_q_parameter_empty_query(
271264
self: Self,
272265
search_term,
273-
enabled_model_catalog_config_map: ConfigMap,
274266
model_catalog_rest_url: list[str],
275267
model_registry_rest_headers: dict[str, str],
276268
):
@@ -288,7 +280,6 @@ def test_q_parameter_empty_query(
288280

289281
def test_q_parameter_with_source_label_filter(
290282
self: Self,
291-
enabled_model_catalog_config_map: ConfigMap,
292283
model_catalog_rest_url: list[str],
293284
model_registry_rest_headers: dict[str, str],
294285
):
@@ -334,7 +325,6 @@ def test_q_parameter_with_source_label_filter(
334325
class TestSearchModelsByFilterQuery:
335326
def test_search_models_by_filter_query(
336327
self: Self,
337-
enabled_model_catalog_config_map: ConfigMap,
338328
model_catalog_rest_url: list[str],
339329
model_registry_rest_headers: dict[str, str],
340330
model_registry_namespace: str,
@@ -380,7 +370,6 @@ def test_search_models_by_filter_query(
380370

381371
def test_search_models_by_invalid_filter_query(
382372
self: Self,
383-
enabled_model_catalog_config_map: ConfigMap,
384373
model_catalog_rest_url: list[str],
385374
model_registry_rest_headers: dict[str, str],
386375
model_registry_namespace: str,
@@ -420,7 +409,6 @@ def test_search_models_by_invalid_filter_query(
420409
@pytest.mark.downstream_only
421410
def test_presence_performance_data_on_pod(
422411
self: Self,
423-
enabled_model_catalog_config_map: ConfigMap,
424412
admin_client: DynamicClient,
425413
model_registry_namespace: str,
426414
):

0 commit comments

Comments
 (0)