forked from opendatahub-io/opendatahub-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_upgrade.py
More file actions
258 lines (232 loc) · 12 KB
/
test_upgrade.py
File metadata and controls
258 lines (232 loc) · 12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
import pytest
from tests.model_serving.model_server.upgrade.utils import (
verify_inference_generation,
verify_pod_containers_not_restarted,
verify_serving_runtime_generation,
)
from tests.model_serving.model_server.utils import verify_inference_response
from utilities.constants import ModelName, Protocols
from utilities.inference_utils import Inference
from utilities.manifests.caikit_standalone import CAIKIT_STANDALONE_INFERENCE_CONFIG
from utilities.manifests.onnx import ONNX_INFERENCE_CONFIG
from utilities.manifests.openvino import OPENVINO_INFERENCE_CONFIG
TEST_SERVERLESS_ONNX_POST_UPGRADE_INFERENCE_SERVICE_EXISTS: str = (
"test_serverless_onnx_post_upgrade_inference_service_exists"
)
TEST_RAW_CAIKIT_BGE_POST_UPGRADE_INFERENCE_EXISTS: str = "test_raw_caikit_bge_post_upgrade_inference_exists"
TEST_MODEL_MESH_OPENVINO_POST_UPGRADE_INFERENCE_EXISTS: str = "test_model_mesh_openvino_post_upgrade_inference_exists"
@pytest.mark.usefixtures("valid_aws_config")
class TestPreUpgradeModelServer:
@pytest.mark.pre_upgrade
@pytest.mark.serverless
def test_serverless_onnx_pre_upgrade_inference(self, ovms_serverless_inference_service_scope_session):
"""Verify that kserve Serverless ONNX model can be queried using REST before upgrade"""
verify_inference_response(
inference_service=ovms_serverless_inference_service_scope_session,
inference_config=ONNX_INFERENCE_CONFIG,
inference_type=Inference.INFER,
protocol=Protocols.HTTPS,
use_default_query=True,
)
@pytest.mark.pre_upgrade
@pytest.mark.rawdeployment
def test_raw_caikit_bge_pre_upgrade_inference(self, caikit_raw_inference_service_scope_session):
"""Test Caikit bge-large-en embedding model inference using internal route before upgrade"""
verify_inference_response(
inference_service=caikit_raw_inference_service_scope_session,
inference_config=CAIKIT_STANDALONE_INFERENCE_CONFIG,
inference_type="embedding",
protocol=Protocols.HTTP,
model_name=ModelName.CAIKIT_BGE_LARGE_EN,
use_default_query=True,
)
@pytest.mark.pre_upgrade
@pytest.mark.modelmesh
def test_model_mesh_openvino_pre_upgrade_inference(self, openvino_model_mesh_inference_service_scope_session):
"""Test OpenVINO ModelMesh inference with internal route before upgrade"""
verify_inference_response(
inference_service=openvino_model_mesh_inference_service_scope_session,
inference_config=OPENVINO_INFERENCE_CONFIG,
inference_type=Inference.INFER,
protocol=Protocols.HTTP,
use_default_query=True,
)
@pytest.mark.pre_upgrade
@pytest.mark.serverless
def test_serverless_authenticated_onnx_pre_upgrade_inference(
self,
ovms_authenticated_serverless_inference_service_scope_session,
http_inference_token_scope_session,
):
"""Verify that kserve Serverless with auth ONNX model can be queried using REST before upgrade"""
verify_inference_response(
inference_service=ovms_authenticated_serverless_inference_service_scope_session,
inference_config=ONNX_INFERENCE_CONFIG,
inference_type=Inference.INFER,
protocol=Protocols.HTTPS,
token=http_inference_token_scope_session,
use_default_query=True,
)
class TestPostUpgradeModelServer:
@pytest.mark.post_upgrade
@pytest.mark.serverless
@pytest.mark.dependency(name=TEST_SERVERLESS_ONNX_POST_UPGRADE_INFERENCE_SERVICE_EXISTS)
def test_serverless_onnx_post_upgrade_inference_service_exists(
self, ovms_serverless_inference_service_scope_session
):
"""Test that the serverless inference service exists after upgrade"""
assert ovms_serverless_inference_service_scope_session.exists
@pytest.mark.post_upgrade
@pytest.mark.serverless
@pytest.mark.dependency(depends=[TEST_SERVERLESS_ONNX_POST_UPGRADE_INFERENCE_SERVICE_EXISTS])
def test_serverless_onnx_post_upgrade_inference_service_not_modified(
self, ovms_serverless_inference_service_scope_session
):
"""Test that the serverless inference service is not modified in upgrade"""
verify_inference_generation(isvc=ovms_serverless_inference_service_scope_session, expected_generation=1)
@pytest.mark.post_upgrade
@pytest.mark.serverless
@pytest.mark.dependency(depends=[TEST_SERVERLESS_ONNX_POST_UPGRADE_INFERENCE_SERVICE_EXISTS])
def test_serverless_onnx_post_upgrade_runtime_not_modified(self, ovms_serverless_inference_service_scope_session):
"""Test that the serverless runtime is not modified in upgrade"""
verify_serving_runtime_generation(isvc=ovms_serverless_inference_service_scope_session, expected_generation=1)
@pytest.mark.post_upgrade
@pytest.mark.serverless
@pytest.mark.dependency(depends=[TEST_SERVERLESS_ONNX_POST_UPGRADE_INFERENCE_SERVICE_EXISTS])
def test_serverless_onnx_post_upgrade_inference(self, ovms_serverless_inference_service_scope_session):
"""Verify that kserve Serverless ONNX model can be queried using REST after upgrade"""
verify_inference_response(
inference_service=ovms_serverless_inference_service_scope_session,
inference_config=ONNX_INFERENCE_CONFIG,
inference_type=Inference.INFER,
protocol=Protocols.HTTPS,
use_default_query=True,
)
@pytest.mark.post_upgrade
@pytest.mark.rawdeployment
@pytest.mark.dependency(name=TEST_RAW_CAIKIT_BGE_POST_UPGRADE_INFERENCE_EXISTS)
def test_raw_caikit_bge_post_upgrade_inference_exists(self, caikit_raw_inference_service_scope_session):
"""Test that raw deployment inference service exists after upgrade"""
assert caikit_raw_inference_service_scope_session.exists
@pytest.mark.post_upgrade
@pytest.mark.rawdeployment
@pytest.mark.dependency(depends=[TEST_RAW_CAIKIT_BGE_POST_UPGRADE_INFERENCE_EXISTS])
def test_raw_caikit_bge_post_upgrade_inference_not_modified(self, caikit_raw_inference_service_scope_session):
"""Test that the raw deployment inference service is not modified in upgrade"""
verify_inference_generation(isvc=caikit_raw_inference_service_scope_session, expected_generation=1)
@pytest.mark.post_upgrade
@pytest.mark.rawdeployment
@pytest.mark.dependency(depends=[TEST_RAW_CAIKIT_BGE_POST_UPGRADE_INFERENCE_EXISTS])
def test_raw_caikit_bge_post_upgrade_runtime_not_modified(self, caikit_raw_inference_service_scope_session):
"""Test that the raw deployment runtime is not modified in upgrade"""
verify_serving_runtime_generation(isvc=caikit_raw_inference_service_scope_session, expected_generation=1)
@pytest.mark.post_upgrade
@pytest.mark.rawdeployment
@pytest.mark.dependency(depends=[TEST_RAW_CAIKIT_BGE_POST_UPGRADE_INFERENCE_EXISTS])
def test_raw_caikit_bge_post_upgrade_inference(self, caikit_raw_inference_service_scope_session):
"""Test Caikit bge-large-en embedding model inference using internal route after upgrade"""
verify_inference_response(
inference_service=caikit_raw_inference_service_scope_session,
inference_config=CAIKIT_STANDALONE_INFERENCE_CONFIG,
inference_type="embedding",
protocol=Protocols.HTTP,
model_name=ModelName.CAIKIT_BGE_LARGE_EN,
use_default_query=True,
)
@pytest.mark.post_upgrade
@pytest.mark.modelmesh
@pytest.mark.dependency(name=TEST_MODEL_MESH_OPENVINO_POST_UPGRADE_INFERENCE_EXISTS)
def test_model_mesh_openvino_post_upgrade_inference_exists(
self, openvino_model_mesh_inference_service_scope_session
):
"""Test that model mesh inference service exists after upgrade"""
assert openvino_model_mesh_inference_service_scope_session.exists
@pytest.mark.post_upgrade
@pytest.mark.modelmesh
@pytest.mark.dependency(depends=[TEST_MODEL_MESH_OPENVINO_POST_UPGRADE_INFERENCE_EXISTS])
def test_model_mesh_openvino_post_upgrade_inference_not_modified(
self, openvino_model_mesh_inference_service_scope_session
):
"""Test that the model mesh deployment inference service is not modified in upgrade"""
verify_inference_generation(
isvc=openvino_model_mesh_inference_service_scope_session,
expected_generation=1,
)
@pytest.mark.post_upgrade
@pytest.mark.modelmesh
@pytest.mark.dependency(depends=[TEST_MODEL_MESH_OPENVINO_POST_UPGRADE_INFERENCE_EXISTS])
def test_model_mesh_openvino_post_upgrade_runtime_not_modified(
self, openvino_model_mesh_inference_service_scope_session
):
"""Test that the model mesh deployment runtime is not modified in upgrade"""
verify_serving_runtime_generation(
isvc=openvino_model_mesh_inference_service_scope_session,
expected_generation=1,
)
@pytest.mark.post_upgrade
@pytest.mark.modelmesh
@pytest.mark.dependency(depends=[TEST_MODEL_MESH_OPENVINO_POST_UPGRADE_INFERENCE_EXISTS])
def test_model_mesh_openvino_post_upgrade_inference(self, openvino_model_mesh_inference_service_scope_session):
"""Test OpenVINO ModelMesh inference with internal route after upgrade"""
verify_inference_response(
inference_service=openvino_model_mesh_inference_service_scope_session,
inference_config=OPENVINO_INFERENCE_CONFIG,
inference_type=Inference.INFER,
protocol=Protocols.HTTP,
use_default_query=True,
)
@pytest.mark.post_upgrade
@pytest.mark.serverless
@pytest.mark.dependency(name="test_serverless_authenticated_onnx_post_upgrade_inference_service_exists")
def test_serverless_authenticated_onnx_post_upgrade_inference_service_exists(
self, ovms_authenticated_serverless_inference_service_scope_session
):
"""Test that the serverless inference service exists after upgrade"""
assert ovms_authenticated_serverless_inference_service_scope_session.exists
@pytest.mark.post_upgrade
@pytest.mark.serverless
@pytest.mark.dependency(depends=["test_serverless_authenticated_onnx_post_upgrade_inference_service_exists"])
def test_serverless_authenticated_onnx_post_upgrade_inference(
self,
ovms_authenticated_serverless_inference_service_scope_session,
http_inference_token_scope_session,
):
"""Verify that kserve Serverless with auth ONNX model can be queried using REST before upgrade"""
verify_inference_response(
inference_service=ovms_authenticated_serverless_inference_service_scope_session,
inference_config=ONNX_INFERENCE_CONFIG,
inference_type=Inference.INFER,
protocol=Protocols.HTTPS,
token=http_inference_token_scope_session,
use_default_query=True,
)
@pytest.mark.post_upgrade
@pytest.mark.serverless
@pytest.mark.rawdeployment
@pytest.mark.modelmesh
def test_verify_odh_model_controller_pod_not_restarted_post_upgrade(self, admin_client):
"""Verify that ODH Model Controller pod is not restarted after upgrade"""
verify_pod_containers_not_restarted(
client=admin_client,
component_name="odh-model-controller",
)
@pytest.mark.post_upgrade
@pytest.mark.serverless
@pytest.mark.rawdeployment
def test_verify_kserve_pod_not_restarted_post_upgrade(self, admin_client):
"""Verify that KServe pod is not restarted after upgrade"""
verify_pod_containers_not_restarted(
client=admin_client,
component_name="kserve",
)
@pytest.mark.post_upgrade
@pytest.mark.modelmesh
def test_verify_model_mesh_pod_not_restarted_post_upgrade(
self,
admin_client,
):
"""Verify that Model Mesh pods are not restarted after upgrade"""
verify_pod_containers_not_restarted(
client=admin_client,
component_name="model-mesh",
)