Skip to content

Commit b6dd983

Browse files
committed
Add default MC validation tests to upgrade
1 parent 6b957af commit b6dd983

File tree

4 files changed

+5
-16
lines changed

4 files changed

+5
-16
lines changed

tests/model_registry/conftest.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
from tests.model_registry.utils import generate_namespace_name
3333
from utilities.general import generate_random_name
3434

35-
from tests.model_registry.utils import delete_model_catalog_configmap
3635

3736
from tests.model_registry.constants import (
3837
MR_OPERATOR_NAME,
@@ -79,7 +78,6 @@ def model_registry_instance(
7978
mr_instance = ModelRegistry(name=MR_INSTANCE_NAME, namespace=model_registry_namespace, ensure_exists=True)
8079
yield [mr_instance]
8180
mr_instance.delete(wait=True)
82-
delete_model_catalog_configmap(admin_client=admin_client, namespace=model_registry_namespace)
8381
else:
8482
LOGGER.warning("Requested Oauth Proxy configuration:")
8583
mr_objects = get_model_registry_objects(
@@ -101,9 +99,6 @@ def model_registry_instance(
10199
)
102100
yield mr_instances
103101

104-
# since model catalog is associated with model registry instances, we need to clean up the config map manually
105-
delete_model_catalog_configmap(admin_client=admin_client, namespace=model_registry_namespace)
106-
107102

108103
@pytest.fixture(scope="class")
109104
def model_registry_metadata_db_resources(

tests/model_registry/model_catalog/test_default_model_catalog.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from ocp_resources.config_map import ConfigMap
1111
from ocp_resources.route import Route
1212
from ocp_resources.service import Service
13+
from tests.model_registry.model_catalog.constants import DEFAULT_CATALOG_ID, DEFAULT_CATALOG_NAME
1314
from tests.model_registry.model_catalog.utils import (
1415
validate_model_catalog_enabled,
1516
execute_get_command,
@@ -25,6 +26,7 @@
2526
"model_registry_namespace",
2627
)
2728
class TestModelCatalog:
29+
@pytest.mark.post_upgrade
2830
def test_config_map_exists(self: Self, catalog_config_map: ConfigMap):
2931
# Check that the default configmaps is created when model registry is
3032
# enabled on data science cluster.
@@ -55,6 +57,7 @@ def test_config_map_exists(self: Self, catalog_config_map: ConfigMap):
5557
),
5658
],
5759
)
60+
@pytest.mark.post_upgrade
5861
def test_model_catalog_resources_exists(
5962
self: Self, admin_client: DynamicClient, model_registry_namespace: str, resource_name: Any
6063
):
@@ -79,6 +82,8 @@ def test_model_catalog_no_custom_catalog(
7982
)["items"]
8083
assert result
8184
assert len(result) == 1, f"Expected no custom models to be present. Actual: {result}"
85+
assert result[0]["id"] == DEFAULT_CATALOG_ID
86+
assert result[0]["name"] == DEFAULT_CATALOG_NAME
8287

8388
def test_default_config_map_not_present(self: Self, model_registry_namespace: str):
8489
# RHOAIENG-33246: Introduced a new configmap. It should be removed before 2.25 release

tests/model_registry/rbac/conftest.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@
2222
from pyhelper_utils.shell import run_command
2323

2424
from tests.model_registry.rbac.utils import wait_for_oauth_openshift_deployment, create_role_binding
25-
from tests.model_registry.utils import delete_model_catalog_configmap
2625
from utilities.general import generate_random_name
2726
from utilities.infra import login_with_user_password
2827
from utilities.user_utils import UserTestSession, create_htpasswd_file, wait_for_user_creation
2928
from tests.model_registry.rbac.group_utils import create_group
3029
from tests.model_registry.constants import (
3130
MR_INSTANCE_NAME,
3231
)
33-
from pytest_testconfig import config as py_config
3432

3533
LOGGER = get_logger(name=__name__)
3634

@@ -355,8 +353,6 @@ def model_registry_instance_parametrized(
355353
f"Created {len(model_registry_instances)} MR instances: {[mr.name for mr in model_registry_instances]}"
356354
)
357355
yield model_registry_instances
358-
# delete the model catalog configmap manually:
359-
delete_model_catalog_configmap(admin_client=admin_client, namespace=py_config["model_registry_namespace"])
360356

361357

362358
@pytest.fixture(scope="session")

tests/model_registry/utils.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
MARIADB_MY_CNF,
2525
PORT_MAP,
2626
MODEL_REGISTRY_POD_FILTER,
27-
DEFAULT_MODEL_CATALOG,
2827
)
2928
from tests.model_registry.exceptions import ModelRegistryResourceNotFoundError
3029
from utilities.exceptions import ProtocolNotSupportedError, TooManyServicesError
@@ -719,12 +718,6 @@ def validate_mlmd_removal_in_model_registry_pod_log(
719718
assert not errors, f"Log validation failed with error(s): {errors}"
720719

721720

722-
def delete_model_catalog_configmap(admin_client: DynamicClient, namespace: str) -> None:
723-
cfg = ConfigMap(name=DEFAULT_MODEL_CATALOG, client=admin_client, namespace=namespace)
724-
if cfg.exists:
725-
cfg.delete(wait=True)
726-
727-
728721
def get_model_catalog_pod(client: DynamicClient, model_registry_namespace: str) -> list[Pod]:
729722
return list(
730723
Pod.get(namespace=model_registry_namespace, label_selector="component=model-catalog", dyn_client=client)

0 commit comments

Comments
 (0)