generated from RedHatQE/python-template-repository
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Milind Waykole <[email protected]>
- Loading branch information
Milind Waykole
committed
Jan 11, 2025
1 parent
e814822
commit bf097b4
Showing
4 changed files
with
199 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
tests/model_serving/model_server/authentication/test_kserve_token_authentication_raw.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import pytest | ||
|
||
from tests.model_serving.model_server.utils import verify_inference_response | ||
from utilities.constants import ModelFormat, ModelStoragePath, Protocols, ModelInferenceRuntime | ||
from utilities.inference_utils import Inference | ||
|
||
pytestmark = pytest.mark.usefixtures("valid_aws_config") | ||
|
||
|
||
@pytest.mark.serverless | ||
@pytest.mark.parametrize( | ||
"model_namespace, s3_models_storage_uri", | ||
[ | ||
pytest.param( | ||
{"name": "kserve-token-authentication"}, | ||
{"model-dir": ModelStoragePath.FLAN_T5_SMALL}, | ||
) | ||
], | ||
indirect=True, | ||
) | ||
class TestKserveTokenAuthenticationRaw: | ||
@pytest.mark.smoke | ||
@pytest.mark.dependency(name="test_model_authentication_using_rest_raw") | ||
def test_model_authentication_using_rest_raw(self, http_s3_caikit_raw_inference_service, http_raw_inference_token): | ||
"""Verify RAW Kserve model query with token using REST""" | ||
verify_inference_response( | ||
inference_service=http_s3_caikit_raw_inference_service, | ||
runtime=ModelInferenceRuntime.CAIKIT_TGIS_RUNTIME, | ||
inference_type=Inference.ALL_TOKENS, | ||
protocol=Protocols.HTTPS, | ||
model_name=ModelFormat.CAIKIT, | ||
use_default_query=True, | ||
token=http_raw_inference_token, | ||
) | ||
|
||
@pytest.mark.smoke | ||
def test_model_raw_authentication_using_grpc(self, grpc_s3_raw_inference_service, grpc_raw_inference_token): | ||
"""Verify model query with token using GRPC""" | ||
verify_inference_response( | ||
inference_service=grpc_s3_raw_inference_service, | ||
runtime=ModelInferenceRuntime.CAIKIT_TGIS_RUNTIME, | ||
inference_type=Inference.STREAMING, | ||
protocol=Protocols.GRPC, | ||
model_name=ModelFormat.CAIKIT, | ||
use_default_query=True, | ||
token=grpc_raw_inference_token, | ||
) | ||
|
||
@pytest.mark.dependency(name="test_disabled_raw_model_authentication") | ||
def test_disabled_raw_model_authentication(self, patched_remove_authentication_isvc): | ||
"""Verify model query after authentication is disabled""" | ||
verify_inference_response( | ||
inference_service=patched_remove_authentication_isvc, | ||
runtime=ModelInferenceRuntime.CAIKIT_TGIS_RUNTIME, | ||
inference_type=Inference.ALL_TOKENS, | ||
protocol=Protocols.HTTP, | ||
model_name=ModelFormat.CAIKIT, | ||
use_default_query=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.