Skip to content

Commit a217cc8

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b3f5700 commit a217cc8

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

tests/model_serving/model_server/inference_service_configuration/conftest.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212

1313
from tests.model_serving.model_server.inference_service_configuration.constants import (
14-
ISVC_ENV_VARS, updated_pull_secret
14+
ISVC_ENV_VARS,
15+
updated_pull_secret,
1516
)
1617
from tests.model_serving.model_server.inference_service_configuration.utils import (
1718
update_inference_service,
@@ -71,13 +72,14 @@ def patched_isvc_replicas(
7172
):
7273
yield ovms_kserve_inference_service
7374

75+
7476
@pytest.fixture(scope="class")
7577
def model_car_raw_inference_service_with_pull_secret(
7678
request: pytest.FixtureRequest,
7779
unprivileged_client: DynamicClient,
7880
unprivileged_model_namespace: Namespace,
7981
serving_runtime_from_template: ServingRuntime,
80-
pull_secrets = ["pull-secret-1"]
82+
pull_secrets=["pull-secret-1"],
8183
) -> Generator[InferenceService, Any, Any]:
8284
with create_isvc(
8385
client=unprivileged_client,
@@ -92,6 +94,7 @@ def model_car_raw_inference_service_with_pull_secret(
9294
) as isvc:
9395
yield isvc
9496

97+
9598
@pytest.fixture(scope="class")
9699
def updated_isvc_pull_secret(
97100
request: pytest.FixtureRequest,
@@ -101,13 +104,7 @@ def updated_isvc_pull_secret(
101104
with update_inference_service(
102105
client=unprivileged_client,
103106
isvc=model_car_raw_inference_service_with_pull_secret,
104-
isvc_updated_dict={
105-
"spec": {
106-
"predictor": {
107-
"imagePullSecrets": [{"name": updated_pull_secret}]
108-
}
109-
}
110-
},
107+
isvc_updated_dict={"spec": {"predictor": {"imagePullSecrets": [{"name": updated_pull_secret}]}}},
111108
wait_for_new_pods=request.param["wait-for-new-pods"],
112109
):
113-
yield model_car_raw_inference_service_with_pull_secret
110+
yield model_car_raw_inference_service_with_pull_secret

tests/model_serving/model_server/inference_service_configuration/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
]
1313

1414
original_pull_secret = "pull-secret-1"
15-
updated_pull_secret = "updated-pull-secret"
15+
updated_pull_secret = "updated-pull-secret"

tests/model_serving/model_server/inference_service_configuration/test_isvc_pull_secret_updates.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import pytest
22

3-
from ocp_resources.inference_service import InferenceService
43

5-
from tests.model_serving.model_server.inference_service_configuration.utils import update_inference_service, verify_pull_secret
6-
from tests.model_serving.model_server.inference_service_configuration.constants import original_pull_secret, updated_pull_secret
7-
from utilities.infra import get_pods_by_isvc_label
4+
from tests.model_serving.model_server.inference_service_configuration.utils import verify_pull_secret
5+
from tests.model_serving.model_server.inference_service_configuration.constants import original_pull_secret
86
from utilities.constants import ModelFormat, ModelName, RuntimeTemplates
97

108

@@ -26,13 +24,11 @@
2624
],
2725
indirect=True,
2826
)
29-
3027
class TestISVCPullSecretUpdate:
3128
def test_initial_pull_secret_set(self, model_car_raw_inference_service_with_pull_secret):
3229
"""Ensure initial pull secret is correctly set in the pod"""
3330
verify_pull_secret(model_car_raw_inference_service_with_pull_secret, original_pull_secret, True)
3431

35-
3632
def test_update_pull_secret(self, updated_isvc_pull_secret):
3733
"""Update the pull secret and verify it is reflected in the new pod"""
3834
verify_pull_secret(updated_isvc_pull_secret, original_pull_secret, True)

tests/model_serving/model_server/inference_service_configuration/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def wait_for_new_running_inference_pods(
109109
LOGGER.error(f"Timeout waiting for pods {oring_pods_names} to be replaced")
110110
raise
111111

112+
112113
def verify_pull_secret(isvc: InferenceService, pull_secret: str, secret_exists: bool) -> None:
113114
"""
114115
Verify that the ImagePullSecret in the InferenceService pods match the expected values.
@@ -125,6 +126,6 @@ def verify_pull_secret(isvc: InferenceService, pull_secret: str, secret_exists:
125126
client=isvc.client,
126127
isvc=isvc,
127128
)[0]
128-
assert (
129-
pod.instance.spec.imagePullSecrets[0].name == pull_secret
130-
), f"Expected pull secret name 'pull-secret-1', got {pod.instance.spec.imagePullSecrets[0].name}"
129+
assert pod.instance.spec.imagePullSecrets[0].name == pull_secret, (
130+
f"Expected pull secret name 'pull-secret-1', got {pod.instance.spec.imagePullSecrets[0].name}"
131+
)

0 commit comments

Comments
 (0)