From 4a819667fa8f0187982455ced3818ee146e8631b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 11 Jan 2025 18:34:37 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../model_server/authentication/conftest.py | 18 +++++++++++++++++- .../test_kserve_token_authentication_raw.py | 2 +- tests/model_serving/model_server/utils.py | 3 +-- uv.lock | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tests/model_serving/model_server/authentication/conftest.py b/tests/model_serving/model_server/authentication/conftest.py index 8dcdcac..81495fe 100644 --- a/tests/model_serving/model_server/authentication/conftest.py +++ b/tests/model_serving/model_server/authentication/conftest.py @@ -88,6 +88,8 @@ def grpc_s3_inference_service( enable_auth=True, ) as isvc: yield isvc + + @pytest.fixture(scope="class") def grpc_s3_raw_inference_service( admin_client: DynamicClient, @@ -110,6 +112,7 @@ def grpc_s3_raw_inference_service( ) as isvc: yield isvc + @pytest.fixture(scope="class") def http_view_role( admin_client: DynamicClient, @@ -123,6 +126,7 @@ def http_view_role( ) as role: yield role + @pytest.fixture(scope="class") def http_raw_view_role( admin_client: DynamicClient, @@ -136,6 +140,7 @@ def http_raw_view_role( ) as role: yield role + @pytest.fixture(scope="class") def http_role_binding( admin_client: DynamicClient, @@ -154,6 +159,7 @@ def http_role_binding( ) as rb: yield rb + @pytest.fixture(scope="class") def http_raw_role_binding( admin_client: DynamicClient, @@ -179,12 +185,14 @@ def http_inference_token(model_service_account: ServiceAccount, http_role_bindin command=shlex.split(f"oc create token -n {model_service_account.namespace} {model_service_account.name}") )[1].strip() + @pytest.fixture(scope="class") def http_raw_inference_token(model_service_account: ServiceAccount, http_raw_role_binding: RoleBinding) -> str: return run_command( command=shlex.split(f"oc create token -n {model_service_account.namespace} {model_service_account.name}") )[1].strip() + @pytest.fixture() def patched_remove_authentication_isvc( admin_client: DynamicClient, @@ -206,6 +214,8 @@ def patched_remove_authentication_isvc( predictor_pod.wait_deleted() yield http_s3_caikit_serverless_inference_service + + @pytest.fixture() def patched_remove_raw_authentication_isvc( admin_client: DynamicClient, @@ -238,6 +248,8 @@ def grpc_view_role(admin_client: DynamicClient, grpc_s3_inference_service: Infer resource_names=[grpc_s3_inference_service.name], ) as role: yield role + + @pytest.fixture(scope="class") def grpc_raw_view_role(admin_client: DynamicClient, grpc_s3_raw_inference_service: InferenceService) -> Role: with create_isvc_view_role( @@ -248,6 +260,7 @@ def grpc_raw_view_role(admin_client: DynamicClient, grpc_s3_raw_inference_servic ) as role: yield role + @pytest.fixture(scope="class") def grpc_role_binding( admin_client: DynamicClient, @@ -284,6 +297,8 @@ def grpc_raw_role_binding( subjects_name=grpc_model_service_account.name, ) as rb: yield rb + + @pytest.fixture(scope="class") def grpc_inference_token(grpc_model_service_account: ServiceAccount, grpc_role_binding: RoleBinding) -> str: return run_command( @@ -292,6 +307,7 @@ def grpc_inference_token(grpc_model_service_account: ServiceAccount, grpc_role_b ) )[1].strip() + @pytest.fixture(scope="class") def grpc_raw_inference_token(grpc_model_service_account: ServiceAccount, grpc_role_binding: RoleBinding) -> str: return run_command( @@ -300,6 +316,7 @@ def grpc_raw_inference_token(grpc_model_service_account: ServiceAccount, grpc_ro ) )[1].strip() + @pytest.fixture(scope="class") def http_s3_caikit_serverless_inference_service( request: FixtureRequest, @@ -347,7 +364,6 @@ def http_s3_caikit_raw_inference_service( yield isvc - # Unprivileged user tests @pytest.fixture(scope="class") def unprivileged_model_namespace( diff --git a/tests/model_serving/model_server/authentication/test_kserve_token_authentication_raw.py b/tests/model_serving/model_server/authentication/test_kserve_token_authentication_raw.py index 94b7ae0..7e8c753 100644 --- a/tests/model_serving/model_server/authentication/test_kserve_token_authentication_raw.py +++ b/tests/model_serving/model_server/authentication/test_kserve_token_authentication_raw.py @@ -56,4 +56,4 @@ def test_disabled_raw_model_authentication(self, patched_remove_authentication_i protocol=Protocols.HTTP, model_name=ModelFormat.CAIKIT, use_default_query=True, - ) \ No newline at end of file + ) diff --git a/tests/model_serving/model_server/utils.py b/tests/model_serving/model_server/utils.py index 25ccd59..892750e 100644 --- a/tests/model_serving/model_server/utils.py +++ b/tests/model_serving/model_server/utils.py @@ -15,7 +15,6 @@ from utilities.constants import KServeDeploymentType from utilities.inference_utils import UserInference from utilities.infra import wait_for_inference_deployment_replicas -from utilities.plugins.openai_plugin import MAX_RETRIES LOGGER = get_logger(name=__name__) @@ -135,8 +134,8 @@ def _check_storage_arguments( if (storage_uri and storage_path) or (not storage_uri and not storage_key) or (storage_key and not storage_path): raise InvalidStorageArgument(storage_uri, storage_key, storage_path) -@retry(stop=stop_after_attempt(5), wait=wait_exponential(min=1, max=6)) +@retry(stop=stop_after_attempt(5), wait=wait_exponential(min=1, max=6)) def verify_inference_response( inference_service: InferenceService, runtime: str, diff --git a/uv.lock b/uv.lock index b0d323f..4f4b22b 100644 --- a/uv.lock +++ b/uv.lock @@ -1782,4 +1782,4 @@ source = { registry = "https://pypi.org/simple" } sdist = { url = "https://files.pythonhosted.org/packages/50/05/51dcca9a9bf5e1bce52582683ce50980bcadbc4fa5143b9f2b19ab99958f/xmltodict-0.14.2.tar.gz", hash = "sha256:201e7c28bb210e374999d1dde6382923ab0ed1a8a5faeece48ab525b7810a553", size = 51942 } wheels = [ { url = "https://files.pythonhosted.org/packages/d6/45/fc303eb433e8a2a271739c98e953728422fa61a3c1f36077a49e395c972e/xmltodict-0.14.2-py2.py3-none-any.whl", hash = "sha256:20cc7d723ed729276e808f26fb6b3599f786cbc37e06c65e192ba77c40f20aac", size = 9981 }, -] \ No newline at end of file +]