Skip to content

Commit 31bb3d1

Browse files
changes to fix model server Test (#1271)
* changes to fix model server Test Signed-off-by: Milind waykole <mwaykole@redhat.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Milind waykole <mwaykole@redhat.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 17db3bd commit 31bb3d1

File tree

5 files changed

+1645
-1598
lines changed

5 files changed

+1645
-1598
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,4 @@ cython_debug/
165165

166166
# VSCode config
167167
.vscode/
168+
.cursor/

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ dependencies = [
5656
"syrupy",
5757
"protobuf",
5858
"grpcio-reflection",
59-
"portforward>=0.7.1",
59+
"portforward>=0.7.6",
6060
"pytest-testconfig>=0.2.0",
6161
"pygithub>=2.5.0",
6262
"timeout-sampler>=1.0.6",

tests/model_serving/model_server/upgrade/conftest.py

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
UPGRADE_RESOURCES: str = (
3131
f"{{Namespace: {{{UPGRADE_NAMESPACE:}}},"
3232
f"ServingRuntime: {{onnx-serverless: {UPGRADE_NAMESPACE},"
33-
f"caikit-raw: {UPGRADE_NAMESPACE},ovms-model-mesh: {UPGRADE_NAMESPACE}}},"
33+
f"onnx-raw: {UPGRADE_NAMESPACE},ovms-model-mesh: {UPGRADE_NAMESPACE}}},"
3434
f"InferenceService: {{onnx-serverless: {UPGRADE_NAMESPACE},"
35-
f"caikit-raw: {UPGRADE_NAMESPACE}, ovms-model-mesh: {UPGRADE_NAMESPACE}}},"
36-
f"Secret: {{ci-bucket-secret: {UPGRADE_NAMESPACE}, models-bucket-secret: {UPGRADE_NAMESPACE}}},"
35+
f"onnx-raw: {UPGRADE_NAMESPACE}, ovms-model-mesh: {UPGRADE_NAMESPACE}}},"
36+
f"Secret: {{ci-bucket-secret: {UPGRADE_NAMESPACE}}},"
3737
f"ServiceAccount: {{models-bucket-sa: {UPGRADE_NAMESPACE}}}}}"
3838
)
3939

@@ -63,29 +63,6 @@ def model_namespace_scope_session(
6363
yield ns
6464

6565

66-
@pytest.fixture(scope="session")
67-
def models_endpoint_s3_secret_scope_session(
68-
admin_client: DynamicClient,
69-
model_namespace_scope_session: Namespace,
70-
aws_access_key_id: str,
71-
aws_secret_access_key: str,
72-
models_s3_bucket_name: str,
73-
models_s3_bucket_region: str,
74-
models_s3_bucket_endpoint: str,
75-
) -> Generator[Secret, Any, Any]:
76-
with s3_endpoint_secret(
77-
admin_client=admin_client,
78-
name="models-bucket-secret",
79-
namespace=model_namespace_scope_session.name,
80-
aws_access_key=aws_access_key_id,
81-
aws_secret_access_key=aws_secret_access_key,
82-
aws_s3_region=models_s3_bucket_region,
83-
aws_s3_bucket=models_s3_bucket_name,
84-
aws_s3_endpoint=models_s3_bucket_endpoint,
85-
) as secret:
86-
yield secret
87-
88-
8966
@pytest.fixture(scope="session")
9067
def ci_endpoint_s3_secret_scope_session(
9168
admin_client: DynamicClient,
@@ -177,49 +154,54 @@ def ovms_serverless_inference_service_scope_session(
177154

178155

179156
@pytest.fixture(scope="session")
180-
def caikit_raw_serving_runtime_scope_session(
157+
def ovms_raw_serving_runtime_scope_session(
181158
admin_client: DynamicClient,
182159
model_namespace_scope_session: Namespace,
183160
) -> Generator[ServingRuntime, Any, Any]:
184161
with ServingRuntimeFromTemplate(
185162
client=admin_client,
186-
name="caikit-raw",
163+
name="onnx-raw",
187164
namespace=model_namespace_scope_session.name,
188-
template_name=RuntimeTemplates.CAIKIT_STANDALONE_SERVING,
165+
template_name=RuntimeTemplates.OVMS_KSERVE,
189166
multi_model=False,
190-
enable_http=True,
167+
resources={
168+
ModelFormat.OVMS: {
169+
"requests": {"cpu": "1", "memory": "4Gi"},
170+
"limits": {"cpu": "2", "memory": "8Gi"},
171+
}
172+
},
173+
model_format_name={ModelFormat.ONNX: ModelVersion.OPSET13},
191174
) as model_runtime:
192175
yield model_runtime
193176

194177

195178
@pytest.fixture(scope="session")
196-
def caikit_raw_inference_service_scope_session(
179+
def ovms_raw_inference_service_scope_session(
197180
pytestconfig: pytest.Config,
198181
admin_client: DynamicClient,
199-
caikit_raw_serving_runtime_scope_session: ServingRuntime,
200-
models_endpoint_s3_secret_scope_session: Secret,
182+
ovms_raw_serving_runtime_scope_session: ServingRuntime,
183+
ci_endpoint_s3_secret_scope_session: Secret,
201184
) -> Generator[InferenceService, Any, Any]:
202185
isvc_kwargs = {
203186
"client": admin_client,
204-
"name": caikit_raw_serving_runtime_scope_session.name,
205-
"namespace": caikit_raw_serving_runtime_scope_session.namespace,
187+
"name": ovms_raw_serving_runtime_scope_session.name,
188+
"namespace": ovms_raw_serving_runtime_scope_session.namespace,
206189
}
207190

208191
isvc = InferenceService(**isvc_kwargs)
209192

210193
if pytestconfig.option.post_upgrade:
211194
yield isvc
212-
213195
isvc.clean_up()
214196

215197
else:
216198
with create_isvc(
217-
runtime=caikit_raw_serving_runtime_scope_session.name,
218-
model_format=caikit_raw_serving_runtime_scope_session.instance.spec.supportedModelFormats[0].name,
199+
runtime=ovms_raw_serving_runtime_scope_session.name,
200+
storage_path="test-dir",
201+
storage_key=ci_endpoint_s3_secret_scope_session.name,
202+
model_format=ModelAndFormat.OPENVINO_IR,
219203
deployment_mode=KServeDeploymentType.RAW_DEPLOYMENT,
220-
storage_key=models_endpoint_s3_secret_scope_session.name,
221-
storage_path=ModelStoragePath.EMBEDDING_MODEL,
222-
external_route=True,
204+
model_version=ModelVersion.OPSET13,
223205
**isvc_kwargs,
224206
) as isvc:
225207
yield isvc

tests/model_serving/model_server/upgrade/test_upgrade.py

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import pytest
22

33
from tests.model_serving.model_server.utils import verify_inference_response
4-
from utilities.constants import ModelName, Protocols
4+
from utilities.constants import Protocols
55
from utilities.inference_utils import Inference
6-
from utilities.manifests.caikit_standalone import CAIKIT_STANDALONE_INFERENCE_CONFIG
76
from utilities.manifests.onnx import ONNX_INFERENCE_CONFIG
87
from utilities.manifests.openvino import OPENVINO_INFERENCE_CONFIG
98

@@ -27,14 +26,13 @@ def test_serverless_onnx_pre_upgrade_inference(self, ovms_serverless_inference_s
2726
)
2827

2928
@pytest.mark.pre_upgrade
30-
def test_raw_caikit_bge_pre_upgrade_inference(self, caikit_raw_inference_service_scope_session):
31-
"""Test Caikit bge-large-en embedding model inference using internal route before upgrade"""
29+
def test_raw_ovms_onnx_pre_upgrade_inference(self, ovms_raw_inference_service_scope_session):
30+
"""Verify that kserve Raw OVMS ONNX model can be queried using REST before upgrade"""
3231
verify_inference_response(
33-
inference_service=caikit_raw_inference_service_scope_session,
34-
inference_config=CAIKIT_STANDALONE_INFERENCE_CONFIG,
35-
inference_type="embedding",
36-
protocol=Protocols.HTTPS,
37-
model_name=ModelName.CAIKIT_BGE_LARGE_EN,
32+
inference_service=ovms_raw_inference_service_scope_session,
33+
inference_config=ONNX_INFERENCE_CONFIG,
34+
inference_type=Inference.INFER,
35+
protocol=Protocols.HTTP,
3836
use_default_query=True,
3937
)
4038

@@ -73,21 +71,20 @@ def test_serverless_onnx_post_upgrade_inference(self, ovms_serverless_inference_
7371
)
7472

7573
@pytest.mark.post_upgrade
76-
@pytest.mark.dependency(name="test_raw_caikit_bge_post_upgrade_inference_exists")
77-
def test_raw_caikit_bge_post_upgrade_inference_exists(self, caikit_raw_inference_service_scope_session):
78-
"""Test that raw deployment inference service exists after upgrade"""
79-
assert caikit_raw_inference_service_scope_session.exists
74+
@pytest.mark.dependency(name="test_raw_ovms_onnx_post_upgrade_inference_exists")
75+
def test_raw_ovms_onnx_post_upgrade_inference_exists(self, ovms_raw_inference_service_scope_session):
76+
"""Test that raw OVMS inference service exists after upgrade"""
77+
assert ovms_raw_inference_service_scope_session.exists
8078

8179
@pytest.mark.post_upgrade
82-
@pytest.mark.dependency(depends=["test_raw_caikit_bge_post_upgrade_inference_exists"])
83-
def test_raw_caikit_bge_post_upgrade_inference(self, caikit_raw_inference_service_scope_session):
84-
"""Test Caikit bge-large-en embedding model inference using internal route after upgrade"""
80+
@pytest.mark.dependency(depends=["test_raw_ovms_onnx_post_upgrade_inference_exists"])
81+
def test_raw_ovms_onnx_post_upgrade_inference(self, ovms_raw_inference_service_scope_session):
82+
"""Verify that kserve Raw OVMS ONNX model can be queried using REST after upgrade"""
8583
verify_inference_response(
86-
inference_service=caikit_raw_inference_service_scope_session,
87-
inference_config=CAIKIT_STANDALONE_INFERENCE_CONFIG,
88-
inference_type="embedding",
89-
protocol=Protocols.HTTPS,
90-
model_name=ModelName.CAIKIT_BGE_LARGE_EN,
84+
inference_service=ovms_raw_inference_service_scope_session,
85+
inference_config=ONNX_INFERENCE_CONFIG,
86+
inference_type=Inference.INFER,
87+
protocol=Protocols.HTTP,
9188
use_default_query=True,
9289
)
9390

0 commit comments

Comments
 (0)