Skip to content

Commit c1de7a5

Browse files
committed
[3.2] Remove enabled_model_catalog_config_map and it's usage
1 parent e802cc9 commit c1de7a5

11 files changed

+1
-119
lines changed

tests/model_registry/model_catalog/conftest.py

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
REDHAT_AI_CATALOG_ID,
1818
DEFAULT_CATALOGS,
1919
)
20-
from tests.model_registry.model_catalog.utils import get_models_from_catalog_api, get_catalog_url_and_headers
20+
from tests.model_registry.model_catalog.utils import get_models_from_catalog_api
2121
from tests.model_registry.constants import (
2222
CUSTOM_CATALOG_ID1,
23-
DEFAULT_MODEL_CATALOG_CM,
2423
DEFAULT_CUSTOM_MODEL_CATALOG,
2524
)
2625
from tests.model_registry.utils import (
@@ -38,57 +37,6 @@
3837
LOGGER = get_logger(name=__name__)
3938

4039

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

tests/model_registry/model_catalog/search/test_model_artifact_search.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, Any
33
import random
4-
from ocp_resources.config_map import ConfigMap
54
from tests.model_registry.model_catalog.search.utils import (
65
fetch_all_artifacts_with_dynamic_paging,
76
validate_model_artifacts_match_criteria_and,
@@ -49,7 +48,6 @@ class TestSearchArtifactsByFilterQuery:
4948
)
5049
def test_search_artifacts_by_invalid_filter_query(
5150
self: Self,
52-
enabled_model_catalog_config_map: ConfigMap,
5351
model_catalog_rest_url: list[str],
5452
model_registry_rest_headers: dict[str, str],
5553
randomly_picked_model_from_catalog_api_by_source: tuple[dict, str, str],
@@ -150,7 +148,6 @@ def test_search_artifacts_by_invalid_filter_query(
150148
)
151149
def test_filter_query_advanced_artifact_search(
152150
self: Self,
153-
enabled_model_catalog_config_map: ConfigMap,
154151
model_catalog_rest_url: list[str],
155152
model_registry_rest_headers: dict[str, str],
156153
randomly_picked_model_from_catalog_api_by_source: tuple[dict, str, str],
@@ -222,7 +219,6 @@ def test_filter_query_advanced_artifact_search(
222219
)
223220
def test_performance_artifacts_recommendations_parameter(
224221
self: Self,
225-
enabled_model_catalog_config_map: ConfigMap,
226222
model_catalog_rest_url: list[str],
227223
model_registry_rest_headers: dict[str, str],
228224
randomly_picked_model_from_catalog_api_by_source: tuple[dict, str, str],

tests/model_registry/model_catalog/search/test_model_search.py

Lines changed: 0 additions & 15 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 (
@@ -33,7 +32,6 @@ class TestSearchModelCatalog:
3332
@pytest.mark.smoke
3433
def test_search_model_catalog_source_label(
3534
self: Self,
36-
enabled_model_catalog_config_map: ConfigMap,
3735
model_catalog_rest_url: list[str],
3836
model_registry_rest_headers: dict[str, str],
3937
):
@@ -66,7 +64,6 @@ def test_search_model_catalog_source_label(
6664

6765
def test_search_model_catalog_invalid_source_label(
6866
self: Self,
69-
enabled_model_catalog_config_map: ConfigMap,
7067
model_catalog_rest_url: list[str],
7168
model_registry_rest_headers: dict[str, str],
7269
):
@@ -109,7 +106,6 @@ def test_search_model_catalog_invalid_source_label(
109106
)
110107
def test_search_model_catalog_match(
111108
self: Self,
112-
enabled_model_catalog_config_map: ConfigMap,
113109
model_catalog_rest_url: list[str],
114110
model_registry_rest_headers: dict[str, str],
115111
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
@@ -153,7 +149,6 @@ class TestSearchModelArtifact:
153149
)
154150
def test_validate_model_artifacts_by_artifact_type(
155151
self: Self,
156-
enabled_model_catalog_config_map: ConfigMap,
157152
model_catalog_rest_url: list[str],
158153
model_registry_rest_headers: dict[str, str],
159154
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
@@ -219,7 +214,6 @@ def test_validate_model_artifacts_by_artifact_type(
219214
)
220215
def test_error_handled_for_invalid_artifact_type(
221216
self: Self,
222-
enabled_model_catalog_config_map: ConfigMap,
223217
model_catalog_rest_url: list[str],
224218
model_registry_rest_headers: dict[str, str],
225219
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
@@ -258,7 +252,6 @@ def test_error_handled_for_invalid_artifact_type(
258252
)
259253
def test_multiple_artifact_type_filtering(
260254
self: Self,
261-
enabled_model_catalog_config_map: ConfigMap,
262255
model_catalog_rest_url: list[str],
263256
model_registry_rest_headers: dict[str, str],
264257
randomly_picked_model_from_catalog_api_by_source: tuple[dict[Any, Any], str, str],
@@ -310,7 +303,6 @@ class TestSearchModelCatalogQParameter:
310303
)
311304
def test_q_parameter_basic_search(
312305
self: Self,
313-
enabled_model_catalog_config_map: ConfigMap,
314306
search_term: str,
315307
model_catalog_rest_url: list[str],
316308
model_registry_rest_headers: dict[str, str],
@@ -350,7 +342,6 @@ def test_q_parameter_basic_search(
350342
)
351343
def test_q_parameter_case_insensitive(
352344
self: Self,
353-
enabled_model_catalog_config_map: ConfigMap,
354345
search_term: str,
355346
case_variant: str,
356347
model_catalog_rest_url: list[str],
@@ -401,7 +392,6 @@ def test_q_parameter_case_insensitive(
401392

402393
def test_q_parameter_no_results(
403394
self: Self,
404-
enabled_model_catalog_config_map: ConfigMap,
405395
model_catalog_rest_url: list[str],
406396
model_registry_rest_headers: dict[str, str],
407397
model_registry_namespace: str,
@@ -431,7 +421,6 @@ def test_q_parameter_no_results(
431421
def test_q_parameter_empty_query(
432422
self: Self,
433423
search_term,
434-
enabled_model_catalog_config_map: ConfigMap,
435424
model_catalog_rest_url: list[str],
436425
model_registry_rest_headers: dict[str, str],
437426
):
@@ -449,7 +438,6 @@ def test_q_parameter_empty_query(
449438

450439
def test_q_parameter_with_source_label_filter(
451440
self: Self,
452-
enabled_model_catalog_config_map: ConfigMap,
453441
model_catalog_rest_url: list[str],
454442
model_registry_rest_headers: dict[str, str],
455443
):
@@ -495,7 +483,6 @@ def test_q_parameter_with_source_label_filter(
495483
class TestSearchModelsByFilterQuery:
496484
def test_search_models_by_filter_query(
497485
self: Self,
498-
enabled_model_catalog_config_map: ConfigMap,
499486
model_catalog_rest_url: list[str],
500487
model_registry_rest_headers: dict[str, str],
501488
model_registry_namespace: str,
@@ -541,7 +528,6 @@ def test_search_models_by_filter_query(
541528

542529
def test_search_models_by_invalid_filter_query(
543530
self: Self,
544-
enabled_model_catalog_config_map: ConfigMap,
545531
model_catalog_rest_url: list[str],
546532
model_registry_rest_headers: dict[str, str],
547533
model_registry_namespace: str,
@@ -581,7 +567,6 @@ def test_search_models_by_invalid_filter_query(
581567
@pytest.mark.downstream_only
582568
def test_presence_performance_data_on_pod(
583569
self: Self,
584-
enabled_model_catalog_config_map: ConfigMap,
585570
admin_client: DynamicClient,
586571
model_registry_namespace: str,
587572
):

tests/model_registry/model_catalog/sorting/test_model_artifacts_sorting.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22
from typing import Self
33
import random
4-
from ocp_resources.config_map import ConfigMap
54
from simple_logger.logger import get_logger
65
from tests.model_registry.model_catalog.sorting.utils import (
76
get_artifacts_with_sorting,
@@ -74,7 +73,6 @@ class TestArtifactsSorting:
7473
)
7574
def test_artifacts_sorting_works_correctly(
7675
self: Self,
77-
enabled_model_catalog_config_map: ConfigMap,
7876
order_by: str,
7977
sort_order: str,
8078
model_catalog_rest_url: list[str],
@@ -191,7 +189,6 @@ class TestCustomPropertiesSorting:
191189
)
192190
def test_custom_properties_sorting_works_correctly(
193191
self: Self,
194-
enabled_model_catalog_config_map: ConfigMap,
195192
order_by: str,
196193
sort_order: str,
197194
model_catalog_rest_url: list[str],

tests/model_registry/model_catalog/sorting/test_model_sorting.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class TestModelsSorting:
3131
)
3232
def test_models_sorting_works_correctly(
3333
self: Self,
34-
enabled_model_catalog_config_map: ConfigMap,
3534
order_by: str,
3635
sort_order: str,
3736
model_catalog_rest_url: list[str],
@@ -62,7 +61,6 @@ class TestAccuracySorting:
6261
)
6362
def test_accuracy_sorting_works_correctly(
6463
self: Self,
65-
enabled_model_catalog_config_map: ConfigMap,
6664
sort_order: str | None,
6765
model_catalog_rest_url: list[str],
6866
model_registry_rest_headers: dict[str, str],
@@ -107,7 +105,6 @@ def test_accuracy_sorting_works_correctly(
107105
)
108106
def test_accuracy_sorting_works_correctly_with_filter(
109107
self: Self,
110-
enabled_model_catalog_config_map: ConfigMap,
111108
sort_order: str,
112109
filter_query: str,
113110
model_catalog_rest_url: list[str],

tests/model_registry/model_catalog/sorting/test_sorting_functionality.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import pytest
22
from typing import Self
3-
from ocp_resources.config_map import ConfigMap
43
from simple_logger.logger import get_logger
54
from tests.model_registry.model_catalog.sorting.utils import (
65
get_sources_with_sorting,
@@ -26,7 +25,6 @@ class TestSourcesSorting:
2625
)
2726
def test_sources_sorting_works_correctly(
2827
self: Self,
29-
enabled_model_catalog_config_map: ConfigMap,
3028
order_by: str,
3129
sort_order: str,
3230
model_catalog_rest_url: list[str],
@@ -49,7 +47,6 @@ def test_sources_sorting_works_correctly(
4947
@pytest.mark.parametrize("unsupported_field", ["CREATE_TIME", "LAST_UPDATE_TIME"])
5048
def test_sources_rejects_unsupported_fields(
5149
self: Self,
52-
enabled_model_catalog_config_map: ConfigMap,
5350
unsupported_field: str,
5451
model_catalog_rest_url: list[str],
5552
model_registry_rest_headers: dict[str, str],

tests/model_registry/model_catalog/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/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)