Skip to content

Commit d39c8b1

Browse files
committed
fix: update tests
1 parent e2e533a commit d39c8b1

5 files changed

Lines changed: 50 additions & 38 deletions

File tree

conftest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,17 @@ def pytest_runtest_setup(item: Item) -> None:
223223
"""
224224
Performs the following actions:
225225
1. Updates global config (`updated_global_config`)
226-
2. Adds `fail_if_missing_dependant_operators` fixture for Serverless and model registry tests.
227-
3. Adds fixtures to enable KServe/model mesh in DSC for model server tests.
226+
2. Adds skip fixture for kserve if serverless or authorino operators are not installed.
227+
3. Adds skip fixture for serverless if authorino/serverless/service mesh are not deployed.
228228
"""
229229

230230
BASIC_LOGGER.info(f"\n{separator(symbol_='-', val=item.name)}")
231231
BASIC_LOGGER.info(f"{separator(symbol_='-', val='SETUP')}")
232232

233-
if "model_registry" in pathlib.Path(item.path).parts or KServeDeploymentType.SERVERLESS.lower() in item.keywords:
234-
item.fixturenames.insert(0, "fail_if_missing_dependant_operators")
235-
236233
if KServeDeploymentType.SERVERLESS.lower() in item.keywords:
234+
item.fixturenames.insert(0, "skip_if_no_deployed_redhat_authorino_operator")
235+
item.fixturenames.insert(0, "skip_if_no_deployed_openshift_serverless")
236+
item.fixturenames.insert(0, "skip_if_no_deployed_openshift_service_mesh")
237237
item.fixturenames.insert(0, "enabled_kserve_in_dsc")
238238

239239
elif KServeDeploymentType.RAW_DEPLOYMENT.lower() in item.keywords:

docs/GETTING_STARTED.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,6 @@ By default, cluster sanity checks are run to make cluster ready for tests.
6767
To skip cluster sanity checks, pass `--cluster-sanity-skip-check` to skip all tests.
6868
To skip RHOAI/ODH-related tests (for example when running in upstream), pass `--cluster-sanity-skip-rhoai-check`.
6969

70-
### Check dependent operators
71-
By default, `Serveless` (serverless-operator), `Authorino` (authorino-operator) and `Service Mesh` (servicemeshoperator) operators are checked to be installed when
72-
running model registry or model server Serverless tests.
73-
To check only specific operator, pass `--tc=dependent_operators:<operator_name>` to pytest.
74-
For example, to check only `Serveless` and `Service Mesh` operators, pass `--tc=dependent_operators:serverless-operator,servicemeshoperator`.
75-
76-
7770
### jira integration
7871
To skip running tests which have open bugs, [pytest_jira](https://github.com/rhevm-qe-automation/pytest_jira) plugin is used.
7972
To run tests with jira integration, you need to set `PYTEST_JIRA_URL` and `PYTEST_JIRA_TOKEN` environment variables.

tests/conftest.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import shortuuid
88
import yaml
99
from _pytest.tmpdir import TempPathFactory
10-
from ocp_resources.cluster_service_version import ClusterServiceVersion
1110
from ocp_resources.config_map import ConfigMap
1211
from ocp_resources.dsc_initialization import DSCInitialization
1312
from ocp_resources.node import Node
@@ -479,27 +478,3 @@ def cluster_sanity_scope_session(
479478
dsci_resource=dsci_resource,
480479
junitxml_property=junitxml_plugin,
481480
)
482-
483-
484-
@pytest.fixture(scope="session")
485-
def fail_if_missing_dependant_operators(admin_client: DynamicClient) -> None:
486-
missing_operators: list[str] = []
487-
488-
for operator_name in py_config.get("dependent_operators", []).split(","):
489-
LOGGER.info(f"Verifying if {operator_name} is installed")
490-
for csv in ClusterServiceVersion.get(
491-
dyn_client=admin_client,
492-
namespace=py_config["applications_namespace"],
493-
):
494-
if csv.name.startswith(operator_name):
495-
if csv.status == csv.Status.SUCCEEDED:
496-
break
497-
498-
else:
499-
missing_operators.append(operator_name)
500-
501-
else:
502-
missing_operators.append(operator_name)
503-
504-
if missing_operators:
505-
pytest.fail(f"Missing dependent operators: {missing_operators}")

tests/global_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
applications_namespace: str = "redhat-ods-applications" # overwritten in conftest.py if distribution is upstream
55
dsc_name: str = "default-dsc"
66
dsci_name: str = "default-dsci"
7-
dependent_operators: str = "servicemeshoperator,authorino-operator,serverless-operator"
87

98
for _dir in dir():
109
val = locals()[_dir]

tests/model_serving/model_server/conftest.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@
44
import yaml
55
from _pytest.fixtures import FixtureRequest
66
from kubernetes.dynamic import DynamicClient
7+
from ocp_resources.authorino import Authorino
8+
from ocp_resources.cluster_service_version import ClusterServiceVersion
79
from ocp_resources.config_map import ConfigMap
810
from ocp_resources.inference_service import InferenceService
911
from ocp_resources.namespace import Namespace
1012
from ocp_resources.persistent_volume_claim import PersistentVolumeClaim
1113
from ocp_resources.secret import Secret
1214
from ocp_resources.service_account import ServiceAccount
15+
from ocp_resources.service_mesh_control_plane import ServiceMeshControlPlane
1316
from ocp_resources.serving_runtime import ServingRuntime
1417
from ocp_resources.storage_class import StorageClass
1518
from ocp_utilities.monitoring import Prometheus
19+
from pytest_testconfig import config as py_config
1620

1721
from utilities.constants import (
1822
KServeDeploymentType,
@@ -36,6 +40,25 @@
3640
from utilities.serving_runtime import ServingRuntimeFromTemplate
3741

3842

43+
@pytest.fixture(scope="package")
44+
def skip_if_no_deployed_openshift_serverless(admin_client: DynamicClient) -> None:
45+
name = "openshift-serverless"
46+
csvs = list(
47+
ClusterServiceVersion.get(
48+
client=admin_client,
49+
namespace=name,
50+
label_selector=f"operators.coreos.com/serverless-operator.{name}",
51+
)
52+
)
53+
if not csvs:
54+
pytest.skip("OpenShift Serverless is not deployed")
55+
56+
csv = csvs[0]
57+
58+
if not (csv.exists and csv.status == csv.Status.SUCCEEDED):
59+
pytest.skip("OpenShift Serverless is not deployed")
60+
61+
3962
@pytest.fixture(scope="class")
4063
def models_endpoint_s3_secret(
4164
admin_client: DynamicClient,
@@ -166,6 +189,28 @@ def skip_if_no_nfs_storage_class(admin_client: DynamicClient) -> None:
166189
pytest.skip(f"StorageClass {StorageClassName.NFS} is missing from the cluster")
167190

168191

192+
@pytest.fixture(scope="package")
193+
def skip_if_no_deployed_redhat_authorino_operator(admin_client: DynamicClient) -> None:
194+
name = "authorino"
195+
namespace = f"{py_config['applications_namespace']}-auth-provider"
196+
197+
if not Authorino(
198+
client=admin_client,
199+
name=name,
200+
namespace=namespace,
201+
).exists:
202+
pytest.skip(f"Authorino {name} CR is missing from {namespace} namespace")
203+
204+
205+
@pytest.fixture(scope="package")
206+
def skip_if_no_deployed_openshift_service_mesh(admin_client: DynamicClient) -> None:
207+
smcp = ServiceMeshControlPlane(client=admin_client, name="data-science-smcp", namespace="istio-system")
208+
if not smcp or not smcp.exists:
209+
pytest.skip("OpenShift service mesh operator is not deployed")
210+
211+
smcp.wait_for_condition(condition=smcp.Condition.READY, status="True")
212+
213+
169214
@pytest.fixture(scope="class")
170215
def http_s3_openvino_model_mesh_inference_service(
171216
request: FixtureRequest,

0 commit comments

Comments
 (0)