Skip to content

Commit c251f03

Browse files
committed
Add test steps in test
Signed-off-by: Milind waykole <mwaykole@redhat.com>
1 parent 850de4b commit c251f03

21 files changed

+238
-8
lines changed

tests/model_serving/model_server/kserve/authentication/test_kserve_token_authentication_raw.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
indirect=True,
2222
)
2323
class TestKserveTokenAuthenticationRawForRest:
24+
"""Validate KServe raw deployment token-based authentication for REST inference.
25+
26+
Steps:
27+
1. Deploy an OVMS model with authentication enabled in a raw deployment namespace.
28+
2. Query the model with a valid token and verify a successful REST inference response.
29+
3. Disable authentication and verify the model is still queryable without a token.
30+
4. Re-enable authentication and verify the model requires a valid token again.
31+
5. Attempt cross-model authentication using another model's token and verify access is denied.
32+
"""
33+
2434
@pytest.mark.smoke
2535
@pytest.mark.ocp_interop
2636
@pytest.mark.dependency(name="test_model_authentication_using_rest_raw")

tests/model_serving/model_server/kserve/authentication/test_non_admin_users.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
@pytest.mark.smoke
2222
@pytest.mark.rawdeployment
2323
class TestRawUnprivilegedUser:
24+
"""Validate that a non-admin user can deploy and query a KServe raw deployment model.
25+
26+
Steps:
27+
1. Create a namespace with unprivileged user credentials.
28+
2. Deploy an OVMS model as a raw deployment using the non-admin user.
29+
3. Query the deployed model via REST and verify a successful inference response.
30+
"""
31+
2432
def test_non_admin_deploy_raw_and_query_model(
2533
self,
2634
unprivileged_s3_ovms_raw_inference_service,

tests/model_serving/model_server/kserve/inference_graph/test_inference_graph_raw.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,22 @@
1919
indirect=True,
2020
)
2121
class TestInferenceGraphRaw:
22+
"""Validate KServe InferenceGraph functionality in raw deployment mode.
23+
24+
Steps:
25+
1. Deploy an OVMS serving runtime with ONNX support in the test namespace.
26+
2. Create inference graphs with various configurations (public, private, auth-enabled).
27+
3. Send inference requests through each graph and verify correct routing and responses.
28+
4. Verify authentication enforcement by testing with privileged and unprivileged tokens.
29+
"""
30+
2231
@pytest.mark.parametrize(
2332
"dog_breed_inference_graph",
2433
[{"name": "dog-breed-raw-pipeline", "deployment-mode": KServeDeploymentType.RAW_DEPLOYMENT}],
2534
indirect=True,
2635
)
2736
def test_inference_graph_raw_deployment(self, dog_breed_inference_graph):
37+
"""Verify inference through a public raw deployment inference graph."""
2838
verify_inference_response(
2939
inference_service=dog_breed_inference_graph,
3040
inference_config=ONNX_INFERENCE_CONFIG,
@@ -46,6 +56,7 @@ def test_inference_graph_raw_deployment(self, dog_breed_inference_graph):
4656
indirect=True,
4757
)
4858
def test_private_inference_graph_raw_deployment(self, dog_breed_inference_graph):
59+
"""Verify inference through a private (no external route) raw deployment inference graph."""
4960
verify_inference_response(
5061
inference_service=dog_breed_inference_graph,
5162
inference_config=ONNX_INFERENCE_CONFIG,
@@ -69,6 +80,7 @@ def test_private_inference_graph_raw_deployment(self, dog_breed_inference_graph)
6980
indirect=True,
7081
)
7182
def test_inference_graph_raw_authentication(self, dog_breed_inference_graph, inference_graph_sa_token_with_access):
83+
"""Verify inference through an auth-enabled inference graph using an authorized service account token."""
7284
verify_inference_response(
7385
inference_service=dog_breed_inference_graph,
7486
inference_config=ONNX_INFERENCE_CONFIG,
@@ -94,6 +106,7 @@ def test_inference_graph_raw_authentication(self, dog_breed_inference_graph, inf
94106
def test_private_inference_graph_raw_authentication(
95107
self, dog_breed_inference_graph, inference_graph_sa_token_with_access
96108
):
109+
"""Verify inference through a private auth-enabled inference graph using an authorized token."""
97110
verify_inference_response(
98111
inference_service=dog_breed_inference_graph,
99112
inference_config=ONNX_INFERENCE_CONFIG,
@@ -119,6 +132,7 @@ def test_private_inference_graph_raw_authentication(
119132
def test_inference_graph_raw_authentication_without_privileges(
120133
self, dog_breed_inference_graph, inference_graph_unprivileged_sa_token
121134
):
135+
"""Verify that an unprivileged token is denied access to an auth-enabled inference graph."""
122136
verify_inference_response(
123137
inference_service=dog_breed_inference_graph,
124138
inference_config=ONNX_INFERENCE_CONFIG,
@@ -145,6 +159,7 @@ def test_inference_graph_raw_authentication_without_privileges(
145159
def test_private_inference_graph_raw_authentication_without_privileges(
146160
self, dog_breed_inference_graph, inference_graph_unprivileged_sa_token
147161
):
162+
"""Verify that an unprivileged token is denied access to a private auth-enabled inference graph."""
148163
verify_inference_response(
149164
inference_service=dog_breed_inference_graph,
150165
inference_config=ONNX_INFERENCE_CONFIG,

tests/model_serving/model_server/kserve/inference_service_lifecycle/test_isvc_env_vars_updates.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@
4343
indirect=True,
4444
)
4545
class TestRawISVCEnvVarsUpdates:
46+
"""Validate adding and removing environment variables on a KServe raw deployment ISVC.
47+
48+
Steps:
49+
1. Deploy an OVMS inference service with custom environment variables.
50+
2. Verify the environment variables are present in the predictor pods.
51+
3. Remove the environment variables from the inference service.
52+
4. Verify the environment variables are no longer present in the predictor pods.
53+
"""
54+
4655
def test_raw_with_isvc_env_vars(self, ovms_kserve_inference_service):
4756
"""Test adding environment variables to the inference service"""
4857
verify_env_vars_in_isvc_pods(isvc=ovms_kserve_inference_service, env_vars=ISVC_ENV_VARS, vars_exist=True)

tests/model_serving/model_server/kserve/inference_service_lifecycle/test_isvc_pull_secret_updates.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
2424
indirect=True,
2525
)
2626
class TestISVCPullSecretUpdate:
27+
"""Validate pull secret lifecycle operations on a KServe model car inference service.
28+
29+
Steps:
30+
1. Deploy a model car ISVC with an initial pull secret attached.
31+
2. Verify the initial pull secret is correctly set in the predictor pod.
32+
3. Update the pull secret to a new value and verify it is reflected in the new pod.
33+
4. Remove the pull secret and verify it is no longer present in the pod.
34+
"""
35+
2736
@pytest.mark.tier1
2837
def test_initial_pull_secret_set(self, model_car_raw_inference_service_with_pull_secret):
2938
"""Ensure initial pull secret is correctly set in the pod"""
@@ -36,4 +45,5 @@ def test_update_pull_secret(self, updated_isvc_pull_secret):
3645
verify_pull_secret(isvc=updated_isvc_pull_secret, pull_secret=UPDATED_PULL_SECRET, secret_exists=True)
3746

3847
def test_remove_pull_secret(self, updated_isvc_remove_pull_secret):
48+
"""Remove the pull secret and verify it is no longer present in the pod."""
3949
verify_pull_secret(isvc=updated_isvc_remove_pull_secret, pull_secret=UPDATED_PULL_SECRET, secret_exists=False)

tests/model_serving/model_server/kserve/inference_service_lifecycle/test_isvc_replicas_update.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
indirect=True,
4040
)
4141
class TestRawISVCReplicasUpdates:
42+
"""Validate scaling replica count up and down on a KServe raw deployment ISVC.
43+
44+
Steps:
45+
1. Deploy an OVMS inference service with 2 min-replicas and 4 max-replicas.
46+
2. Verify that 2 predictor pods are running after deployment.
47+
3. Run inference to confirm the model responds correctly with multiple replicas.
48+
4. Patch the ISVC to scale down to 1 replica and verify only 1 pod remains.
49+
5. Run inference again to confirm the model responds correctly after scale-down.
50+
"""
51+
4252
@pytest.mark.dependency(name="test_raw_increase_isvc_replicas")
4353
def test_raw_increase_isvc_replicas(self, isvc_pods, ovms_kserve_inference_service):
4454
"""Test replicas increase"""

tests/model_serving/model_server/kserve/inference_service_lifecycle/test_raw_stop_resume_model.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@
3333
indirect=True,
3434
)
3535
class TestStopRaw:
36+
"""Validate stopping a running KServe raw deployment model via the stop annotation.
37+
38+
Steps:
39+
1. Deploy an OVMS ONNX model as a raw deployment with stop set to false.
40+
2. Verify the model can be queried via REST.
41+
3. Patch the ISVC stop annotation to true.
42+
4. Verify all predictor pods are deleted and remain absent.
43+
"""
44+
3645
def test_raw_onnx_rest_inference(
3746
self, unprivileged_model_namespace, ovms_kserve_serving_runtime, ovms_raw_inference_service
3847
):
@@ -58,8 +67,7 @@ def test_stop_and_update_to_true_delete_pod_rollout(
5867
ovms_raw_inference_service,
5968
patched_raw_inference_service_stop_annotation,
6069
):
61-
"""Verify pod rollout is deleted when the stop annotation updated to true"""
62-
"""Verify pods do not exist"""
70+
"""Verify pod rollout is deleted when the stop annotation is updated to true."""
6371
result = consistently_verify_no_pods_exist(
6472
client=unprivileged_client,
6573
isvc=patched_raw_inference_service_stop_annotation,
@@ -86,15 +94,23 @@ def test_stop_and_update_to_true_delete_pod_rollout(
8694
indirect=True,
8795
)
8896
class TestStoppedResumeRaw:
97+
"""Validate resuming a stopped KServe raw deployment model by clearing the stop annotation.
98+
99+
Steps:
100+
1. Deploy an OVMS ONNX model as a raw deployment with stop set to true.
101+
2. Verify no predictor pods are created while the stop annotation is true.
102+
3. Patch the ISVC stop annotation to false.
103+
4. Verify predictor pods are rolled out and the model can be queried via REST.
104+
"""
105+
89106
def test_stop_and_true_no_pod_rollout(
90107
self,
91108
unprivileged_client,
92109
unprivileged_model_namespace,
93110
ovms_kserve_serving_runtime,
94111
ovms_raw_inference_service,
95112
):
96-
"""Verify no pod rollout when the stop annotation is true"""
97-
"""Verify pods do not exist"""
113+
"""Verify no pod rollout when the stop annotation is true."""
98114
result = consistently_verify_no_pods_exist(
99115
client=unprivileged_client,
100116
isvc=ovms_raw_inference_service,
@@ -114,8 +130,7 @@ def test_stop_and_update_to_false_pod_rollout(
114130
ovms_raw_inference_service,
115131
patched_raw_inference_service_stop_annotation,
116132
):
117-
"""Verify pod rollout when the stop annotation is updated to false"""
118-
"""Verify that kserve Raw ONNX model can be queried using REST"""
133+
"""Verify pod rollout and REST inference after the stop annotation is set to false."""
119134
verify_inference_response(
120135
inference_service=patched_raw_inference_service_stop_annotation,
121136
inference_config=ONNX_INFERENCE_CONFIG,

tests/model_serving/model_server/kserve/ingress/test_route_reconciliation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ def test_raw_onnx_rout_reconciliation(self, ovms_raw_inference_service):
3939
)
4040

4141
def test_route_value_before_and_after_deletion(self, unprivileged_client, ovms_raw_inference_service):
42-
# Validate ingress status before and after route deletion
42+
"""Verify that the ingress status changes after the route is deleted and recreated."""
4343
assert_ingress_status_changed(client=unprivileged_client, inference_service=ovms_raw_inference_service)
4444

4545
def test_model_works_after_route_is_recreated(self, ovms_raw_inference_service):
46-
# Final inference validation after route update
46+
"""Verify that the model is still queryable via REST after the route is recreated."""
4747
verify_inference_response(
4848
inference_service=ovms_raw_inference_service,
4949
inference_config=ONNX_INFERENCE_CONFIG,

tests/model_serving/model_server/kserve/ingress/test_route_visibility.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@
4444
indirect=True,
4545
)
4646
class TestRestRawDeploymentRoutes:
47+
"""Validate REST route visibility transitions for KServe raw deployment.
48+
49+
Steps:
50+
1. Deploy a Caikit-TGIS model as a raw deployment with HTTP enabled.
51+
2. Verify the default route visibility label is not set.
52+
3. Query the model via the internal route and confirm a successful response.
53+
4. Patch the ISVC to expose the route externally and verify inference over HTTPS.
54+
5. Revert the route to local-cluster visibility and verify external access is disabled.
55+
"""
56+
4757
def test_default_visibility_value(self, s3_models_inference_service):
4858
"""Test default route visibility value"""
4959
if labels := s3_models_inference_service.labels:
@@ -126,6 +136,15 @@ def test_disabled_rest_raw_deployment_exposed_route(self, patched_s3_caikit_kser
126136
indirect=True,
127137
)
128138
class TestRestRawDeploymentRoutesTimeout:
139+
"""Validate REST route timeout behavior for KServe raw deployment.
140+
141+
Steps:
142+
1. Deploy a Caikit-TGIS model as a raw deployment with an external route.
143+
2. Verify inference succeeds over the exposed HTTPS route.
144+
3. Patch the route with an extremely low timeout annotation.
145+
4. Verify inference fails with a 504 Gateway Time-out error.
146+
"""
147+
129148
@pytest.mark.dependency(name="test_rest_raw_deployment_exposed_route")
130149
def test_rest_raw_deployment_exposed_route(self, s3_models_inference_service):
131150
"""Test HTTP inference using exposed (external) route"""
@@ -191,6 +210,14 @@ def test_rest_raw_deployment_exposed_route_with_timeout(self, s3_models_inferenc
191210
)
192211
@pytest.mark.skip(reason="skipping grpc raw for tgis-caikit")
193212
class TestGrpcRawDeployment:
213+
"""Validate gRPC route visibility transitions for KServe raw deployment.
214+
215+
Steps:
216+
1. Deploy a Caikit-TGIS model as a raw deployment with gRPC enabled.
217+
2. Query the model via the internal gRPC route and confirm a successful streaming response.
218+
3. Patch the ISVC to expose the route externally and verify gRPC inference over the exposed route.
219+
"""
220+
194221
def test_grpc_raw_deployment_internal_route(self, s3_models_inference_service):
195222
"""Test GRPC inference using internal route"""
196223
verify_inference_response(
@@ -247,6 +274,15 @@ def test_grpc_raw_deployment_exposed_route(self, patched_s3_caikit_kserve_isvc_v
247274
)
248275
@pytest.mark.skip(reason="skipping grpc raw for tgis-caikit")
249276
class TestGrpcRawDeploymentTimeout:
277+
"""Validate gRPC route timeout behavior for KServe raw deployment.
278+
279+
Steps:
280+
1. Deploy a Caikit-TGIS model as a raw deployment with an external gRPC route.
281+
2. Verify gRPC inference succeeds over the exposed route.
282+
3. Patch the route with an extremely low timeout annotation.
283+
4. Verify gRPC inference fails with a 504 Gateway Time-out error.
284+
"""
285+
250286
@pytest.mark.dependency(name="test_grpc_raw_deployment_exposed_route")
251287
def test_grpc_raw_deployment_exposed_route(self, s3_models_inference_service):
252288
"""Test GRPC inference using exposed (external) route"""

tests/model_serving/model_server/kserve/multi_node/test_nvidia_multi_node.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@
4747
indirect=True,
4848
)
4949
class TestMultiNode:
50+
"""Validate multi-node GPU inference with Ray-based vLLM serving on KServe.
51+
52+
Steps:
53+
1. Deploy a Granite-8B model on a multi-node vLLM inference service backed by PVC storage.
54+
2. Verify Ray cluster health and NVIDIA GPU status across head and worker pods.
55+
3. Validate default runtime worker spec (tensorParallelSize=1, pipelineParallelSize=2).
56+
4. Confirm pods are distributed across GPU nodes and TLS certificates are provisioned.
57+
5. Test pod resilience by deleting head and worker pods and verifying inference recovery.
58+
6. Validate TLS secret reconciliation, runtime deletion cleanup, and runtime re-creation.
59+
7. Test external route inference and dynamic updates to tensor/pipeline parallel sizes.
60+
8. Verify model args propagation to and removal from the vLLM command spec.
61+
"""
62+
5063
def test_multi_node_ray_status(self, multi_node_predictor_pods_scope_class):
5164
"""Test multi node ray status"""
5265
verify_ray_status(pods=multi_node_predictor_pods_scope_class)

0 commit comments

Comments
 (0)