forked from opendatahub-io/opendatahub-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_model_mesh_authentication.py
More file actions
98 lines (89 loc) · 4.11 KB
/
test_model_mesh_authentication.py
File metadata and controls
98 lines (89 loc) · 4.11 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
import pytest
from tests.model_serving.model_server.utils import verify_inference_response
from utilities.constants import (
ModelStoragePath,
Protocols,
)
from utilities.inference_utils import Inference
from utilities.manifests.openvino import OPENVINO_INFERENCE_CONFIG
pytestmark = [pytest.mark.modelmesh, pytest.mark.sanity, pytest.mark.rhoai_2_16]
@pytest.mark.parametrize(
"model_namespace, http_s3_ovms_model_mesh_serving_runtime, http_s3_openvino_model_mesh_inference_service",
[
pytest.param(
{"name": "model-mesh-authentication", "modelmesh-enabled": True},
{"enable-auth": True, "enable-external-route": True},
{"model-path": ModelStoragePath.OPENVINO_EXAMPLE_MODEL},
)
],
indirect=True,
)
class TestModelMeshAuthentication:
"""Model Mesh Authentication is based on the created Service; cross-model authentication is not blocked"""
@pytest.mark.dependency(name="test_model_mesh_model_authentication_openvino_inference_with_tensorflow")
def test_model_mesh_model_authentication_openvino_inference_with_tensorflow(
self,
http_s3_openvino_model_mesh_inference_service,
http_model_mesh_inference_token,
):
"""Verify model query with token using REST"""
verify_inference_response(
inference_service=http_s3_openvino_model_mesh_inference_service,
inference_config=OPENVINO_INFERENCE_CONFIG,
inference_type=Inference.INFER,
protocol=Protocols.HTTPS,
use_default_query=True,
token=http_model_mesh_inference_token,
)
@pytest.mark.dependency(name="test_model_mesh_disabled_model_authentication")
def test_model_mesh_disabled_model_authentication(
self,
patched_remove_authentication_model_mesh_runtime,
http_s3_openvino_model_mesh_inference_service,
):
"""Verify model query after authentication is disabled"""
verify_inference_response(
inference_service=http_s3_openvino_model_mesh_inference_service,
inference_config=OPENVINO_INFERENCE_CONFIG,
inference_type=Inference.INFER,
protocol=Protocols.HTTPS,
use_default_query=True,
)
@pytest.mark.dependency(depends=["test_model_mesh_disabled_model_authentication"])
def test_model_mesh_re_enabled_model_authentication(
self,
http_s3_openvino_model_mesh_inference_service,
http_model_mesh_inference_token,
):
"""Verify model query after authentication is re-enabled"""
verify_inference_response(
inference_service=http_s3_openvino_model_mesh_inference_service,
inference_config=OPENVINO_INFERENCE_CONFIG,
inference_type=Inference.INFER,
protocol=Protocols.HTTPS,
use_default_query=True,
token=http_model_mesh_inference_token,
)
@pytest.mark.dependency(depends=["test_model_mesh_model_authentication_openvino_inference_with_tensorflow"])
def test_model_mesh_model_authentication_using_invalid_token(self, http_s3_openvino_model_mesh_inference_service):
"""Verify model query with an invalid token"""
verify_inference_response(
inference_service=http_s3_openvino_model_mesh_inference_service,
inference_config=OPENVINO_INFERENCE_CONFIG,
inference_type=Inference.INFER,
protocol=Protocols.HTTPS,
use_default_query=True,
token="dummy",
authorized_user=False,
)
@pytest.mark.dependency(depends=["test_model_mesh_model_authentication_openvino_inference_with_tensorflow"])
def test_model_mesh_model_authentication_without_token(self, http_s3_openvino_model_mesh_inference_service):
"""Verify model query without providing a token"""
verify_inference_response(
inference_service=http_s3_openvino_model_mesh_inference_service,
inference_config=OPENVINO_INFERENCE_CONFIG,
inference_type=Inference.INFER,
protocol=Protocols.HTTPS,
use_default_query=True,
authorized_user=False,
)