Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 11, 2025
1 parent 906b6ec commit 4a81966
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
18 changes: 17 additions & 1 deletion tests/model_serving/model_server/authentication/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -123,6 +126,7 @@ def http_view_role(
) as role:
yield role


@pytest.fixture(scope="class")
def http_raw_view_role(
admin_client: DynamicClient,
Expand All @@ -136,6 +140,7 @@ def http_raw_view_role(
) as role:
yield role


@pytest.fixture(scope="class")
def http_role_binding(
admin_client: DynamicClient,
Expand All @@ -154,6 +159,7 @@ def http_role_binding(
) as rb:
yield rb


@pytest.fixture(scope="class")
def http_raw_role_binding(
admin_client: DynamicClient,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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(
Expand All @@ -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,
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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,
Expand Down Expand Up @@ -347,7 +364,6 @@ def http_s3_caikit_raw_inference_service(
yield isvc



# Unprivileged user tests
@pytest.fixture(scope="class")
def unprivileged_model_namespace(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
)
3 changes: 1 addition & 2 deletions tests/model_serving/model_server/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4a81966

Please sign in to comment.