Skip to content

Commit c5ca79f

Browse files
fegedbasunag
andauthored
Add validation for MR to be ready after it is GA (#574)
* change: add validation for MR to be ready after it is GA * change: use registerd namespace * change: assert ns name based on distribution * change: split test and use fixture for the dsc_resource --------- Co-authored-by: Debarati Basu-Nag <dbasunag@redhat.com>
1 parent 50ab82e commit c5ca79f

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import pytest
2+
from utilities.constants import DscComponents
3+
4+
from ocp_resources.data_science_cluster import DataScienceCluster
5+
from ocp_resources.namespace import Namespace
6+
7+
from simple_logger.logger import get_logger
8+
from pytest_testconfig import config as py_config
9+
10+
11+
LOGGER = get_logger(name=__name__)
12+
13+
14+
@pytest.mark.cluster_health
15+
class TestMrDefault:
16+
def test_mr_management_state(self, dsc_resource: DataScienceCluster):
17+
"""Verify MODELREGISTRY managementState is MANAGED in DSC."""
18+
assert (
19+
dsc_resource.instance.spec.components[DscComponents.MODELREGISTRY].managementState
20+
== DscComponents.ManagementState.MANAGED
21+
)
22+
23+
def test_mr_namespace_exists_and_active(self, dsc_resource: DataScienceCluster):
24+
"""Verify MR namespace exists and is in Active state."""
25+
namespace = Namespace(
26+
name=dsc_resource.instance.spec.components[DscComponents.MODELREGISTRY].registriesNamespace,
27+
ensure_exists=True,
28+
)
29+
assert namespace.instance.status.phase == Namespace.Status.ACTIVE
30+
assert namespace.instance.metadata.name == py_config["model_registry_namespace"]
31+
32+
def test_mr_condition_in_dsc(self, dsc_resource: DataScienceCluster):
33+
"""Verify MR ready condition is True in DSC."""
34+
for condition in dsc_resource.instance.status.conditions:
35+
if condition.type == DscComponents.COMPONENT_MAPPING[DscComponents.MODELREGISTRY]:
36+
assert condition.status == "True"
37+
break
38+
else:
39+
pytest.fail("MR ready condition not found in DSC")

0 commit comments

Comments
 (0)