Skip to content

Commit 985bb9f

Browse files
author
Milind Waykole
committed
Add new test for maistra
Signed-off-by: Milind Waykole <mwaykole@mwaykole-thinkpadp1gen4i.bengluru.csb>
1 parent 09f0343 commit 985bb9f

File tree

3 files changed

+87
-1
lines changed

3 files changed

+87
-1
lines changed

tests/model_serving/model_server/serverless/conftest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,9 @@ def s3_flan_small_hf_caikit_serverless_inference_service(
8686
deployment_mode=KServeDeploymentType.SERVERLESS,
8787
external_route=True,
8888
) as isvc:
89-
yield isvc
89+
yield isvc @ pytest.fixture(scope="class")
90+
91+
92+
@pytest.fixture(scope="class")
93+
def deleted_isvc(ovms_serverless_inference_service: InferenceService) -> None:
94+
ovms_serverless_inference_service.clean_up()
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import pytest
2+
from ocp_utilities.infra import get_pods_by_name_prefix
3+
from pytest_testconfig import py_config
4+
from simple_logger.logger import get_logger
5+
from timeout_sampler import TimeoutSampler, TimeoutExpiredError
6+
7+
from tests.model_serving.model_server.utils import verify_inference_response
8+
from utilities.constants import (
9+
ModelFormat,
10+
ModelInferenceRuntime,
11+
ModelVersion,
12+
Protocols,
13+
Timeout,
14+
)
15+
from utilities.exceptions import PodLogMissMatchError
16+
from utilities.inference_utils import Inference
17+
from utilities.manifests.onnx import ONNX_INFERENCE_CONFIG
18+
19+
pytestmark = [
20+
pytest.mark.serverless,
21+
pytest.mark.sanity,
22+
pytest.mark.usefixtures("valid_aws_config"),
23+
]
24+
25+
LOGGER = get_logger(name=__name__)
26+
27+
28+
@pytest.mark.serverless
29+
@pytest.mark.parametrize(
30+
"model_namespace, openvino_kserve_serving_runtime, ovms_serverless_inference_service",
31+
[
32+
pytest.param(
33+
{"name": "serverless-maistra"},
34+
{
35+
"runtime-name": ModelInferenceRuntime.ONNX_RUNTIME,
36+
"model-format": {ModelFormat.ONNX: ModelVersion.OPSET13},
37+
},
38+
{
39+
"name": ModelFormat.ONNX,
40+
"model-version": ModelVersion.OPSET13,
41+
"model-dir": "test-dir",
42+
},
43+
)
44+
],
45+
indirect=True,
46+
)
47+
class TestLogForOdHModelController:
48+
def test_odh_model_controller_failing_while_deleted_isvc(self, ovms_serverless_inference_service):
49+
"""Verify model can be queried"""
50+
verify_inference_response(
51+
inference_service=ovms_serverless_inference_service,
52+
inference_config=ONNX_INFERENCE_CONFIG,
53+
inference_type=Inference.INFER,
54+
protocol=Protocols.HTTPS,
55+
use_default_query=True,
56+
)
57+
58+
def test_moniter_odh_logs_doe_maistra(self, deleted_isvc, admin_client):
59+
"""Delete isvc and check pod logs for unexpected 'Maistra' string"""
60+
search_string = "maistra.io"
61+
pod = get_pods_by_name_prefix(
62+
client=admin_client, namespace=py_config["applications_namespace"], pod_prefix="odh-model-controller"
63+
)[0]
64+
65+
try:
66+
log_sampler = TimeoutSampler(
67+
wait_timeout=Timeout.TIMEOUT_1MIN,
68+
sleep=5,
69+
func=lambda: pod.log(container="manager", tail_lines=100, timestamps=True),
70+
)
71+
72+
for log_output in log_sampler:
73+
LOGGER.info("Log output fetched during sampling:")
74+
if search_string in log_output:
75+
raise PodLogMissMatchError(f"'{search_string}' was found in pod logs")
76+
LOGGER.info(f"'{search_string}' was not found in pod logs within timeout")
77+
78+
except TimeoutExpiredError as e:
79+
LOGGER.error(f"Timeout while sampling logs: {str(e)}")

utilities/exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,5 @@ class DeploymentValidationError(Exception):
7676

7777
class InferenceCanaryTrafficError(Exception):
7878
pass
79+
class PodLogMissMatchError(Exception):
80+
pass

0 commit comments

Comments
 (0)