Skip to content

Commit 78e7e35

Browse files
committed
Add health check for test cases llmd
Signed-off-by: Milind waykole <mwaykole@redhat.com>
1 parent 7a7c780 commit 78e7e35

File tree

1 file changed

+11
-28
lines changed

1 file changed

+11
-28
lines changed

tests/model_serving/model_server/llmd/conftest.py

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from ocp_resources.config_map import ConfigMap
1313
from ocp_resources.deployment import Deployment
1414
from ocp_resources.gateway import Gateway
15-
from ocp_resources.gateway_class import GatewayClass
1615
from ocp_resources.llm_inference_service import LLMInferenceService
1716
from ocp_resources.namespace import Namespace
1817
from ocp_resources.resource import Resource
@@ -56,7 +55,7 @@ def _verify_operator_csv(admin_client: DynamicClient, csv_prefix: str, namespace
5655
for csv in ClusterServiceVersion.get(client=admin_client, namespace=namespace):
5756
if csv.name.startswith(csv_prefix) and csv.status == csv.Status.SUCCEEDED:
5857
return
59-
pytest.skip(f"Operator CSV {csv_prefix} not found or not Succeeded in {namespace}")
58+
pytest.fail(f"Operator CSV {csv_prefix} not found or not Succeeded in {namespace}")
6059

6160

6261
def verify_llmd_health(admin_client: DynamicClient, dsc_resource: Resource) -> None:
@@ -69,10 +68,10 @@ def verify_llmd_health(admin_client: DynamicClient, dsc_resource: Resource) -> N
6968
for condition in dsc_resource.instance.status.conditions:
7069
if condition.type == LLMD_DSC_CONDITION:
7170
if condition.status != "True":
72-
pytest.skip(f"{LLMD_DSC_CONDITION} is not ready: {condition.status}, reason: {condition.get('reason')}")
71+
pytest.fail(f"{LLMD_DSC_CONDITION} is not ready: {condition.status}, reason: {condition.get('reason')}")
7372
break
7473
else:
75-
pytest.skip(f"{LLMD_DSC_CONDITION} condition not found in DSC status")
74+
pytest.fail(f"{LLMD_DSC_CONDITION} condition not found in DSC status")
7675

7776
# 2. Operator CSVs
7877
for csv_prefix, namespace in LLMD_REQUIRED_OPERATORS.items():
@@ -82,55 +81,39 @@ def verify_llmd_health(admin_client: DynamicClient, dsc_resource: Resource) -> N
8281
for name, namespace in LLMD_REQUIRED_DEPLOYMENTS.items():
8382
deployment = Deployment(client=admin_client, name=name, namespace=namespace)
8483
if not deployment.exists:
85-
pytest.skip(f"LLMD dependency deployment {name} not found in {namespace}")
84+
pytest.fail(f"LLMD dependency deployment {name} not found in {namespace}")
8685

8786
dep_available = False
8887
for condition in deployment.instance.status.get("conditions", []):
8988
if condition.type == "Available":
9089
if condition.status != "True":
91-
pytest.skip(f"Deployment {name} in {namespace} is not Available: {condition.get('reason')}")
90+
pytest.fail(f"Deployment {name} in {namespace} is not Available: {condition.get('reason')}")
9291
dep_available = True
9392
break
9493

9594
if not dep_available:
96-
pytest.skip(f"Deployment {name} in {namespace} has no Available condition")
95+
pytest.fail(f"Deployment {name} in {namespace} has no Available condition")
9796

9897
# 4. LeaderWorkerSetOperator CR
9998
lws_operator = LeaderWorkerSetOperator(client=admin_client, name="cluster")
10099
if not lws_operator.exists:
101-
pytest.skip("LeaderWorkerSetOperator 'cluster' CR not found")
100+
pytest.fail("LeaderWorkerSetOperator 'cluster' CR not found")
102101

103102
lws_available = False
104103
for condition in lws_operator.instance.status.get("conditions", []):
105104
if condition.type == "Available":
106105
if condition.status != "True":
107-
pytest.skip(f"LeaderWorkerSetOperator is not Available: {condition.get('reason')}")
106+
pytest.fail(f"LeaderWorkerSetOperator is not Available: {condition.get('reason')}")
108107
lws_available = True
109108
break
110109

111110
if not lws_available:
112-
pytest.skip("LeaderWorkerSetOperator has no Available condition")
111+
pytest.fail("LeaderWorkerSetOperator has no Available condition")
113112

114-
# 5. GatewayClass
115-
gateway_class = GatewayClass(client=admin_client, name="openshift-default")
116-
if not gateway_class.exists:
117-
pytest.skip("GatewayClass 'openshift-default' not found")
118-
119-
gc_accepted = False
120-
for condition in gateway_class.instance.status.get("conditions", []):
121-
if condition.type == "Accepted":
122-
if condition.status != "True":
123-
pytest.skip(f"GatewayClass 'openshift-default' is not Accepted: {condition.get('reason')}")
124-
gc_accepted = True
125-
break
126-
127-
if not gc_accepted:
128-
pytest.skip("GatewayClass 'openshift-default' has no Accepted condition")
129-
130-
# 6. Kuadrant CR
113+
# 5. Kuadrant CR
131114
kuadrant = Kuadrant(client=admin_client, name="kuadrant", namespace="kuadrant-system")
132115
if not kuadrant.exists:
133-
pytest.skip("Kuadrant 'kuadrant' CR not found")
116+
pytest.fail("Kuadrant 'kuadrant' CR not found")
134117

135118
LOGGER.info("LLMD component health check passed")
136119

0 commit comments

Comments
 (0)