Skip to content

Commit 7468681

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

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

tests/model_serving/maas_billing/maas_subscription/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ def ephemeral_api_key(
814814
request_session_http: requests.Session,
815815
base_url: str,
816816
ocp_token_for_actor: str,
817-
) -> Generator[dict[str, Any], None, None]:
817+
) -> Generator[dict[str, Any]]:
818818
"""Create an ephemeral API key and revoke it on teardown."""
819819
create_resp, create_body = create_api_key(
820820
base_url=base_url,

tests/model_serving/maas_billing/maas_subscription/test_api_key_ephemeral_cleanup.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,11 @@ def test_cronjob_exists_and_configured(self, admin_client: DynamicClient) -> Non
3737
name=MAAS_CLEANUP_CRONJOB_NAME,
3838
namespace=applications_namespace,
3939
)
40-
assert cronjob.exists, (
41-
f"CronJob {MAAS_CLEANUP_CRONJOB_NAME} not found in {applications_namespace}"
42-
)
40+
assert cronjob.exists, f"CronJob {MAAS_CLEANUP_CRONJOB_NAME} not found in {applications_namespace}"
4341

4442
spec = cronjob.instance.spec
4543

46-
assert spec.schedule == "*/15 * * * *", (
47-
f"Expected schedule '*/15 * * * *', got '{spec.schedule}'"
48-
)
44+
assert spec.schedule == "*/15 * * * *", f"Expected schedule '*/15 * * * *', got '{spec.schedule}'"
4945
assert spec.concurrencyPolicy == "Forbid", (
5046
"CronJob should use Forbid concurrency policy to prevent overlapping runs"
5147
)
@@ -61,13 +57,9 @@ def test_cronjob_exists_and_configured(self, admin_client: DynamicClient) -> Non
6157
sec_ctx = getattr(container_spec, "securityContext", None)
6258
assert sec_ctx is not None, "Cleanup container should have securityContext configured"
6359
assert sec_ctx.runAsNonRoot is True, "Cleanup container should run as non-root"
64-
assert sec_ctx.readOnlyRootFilesystem is True, (
65-
"Cleanup container should have read-only root filesystem"
66-
)
60+
assert sec_ctx.readOnlyRootFilesystem is True, "Cleanup container should have read-only root filesystem"
6761

68-
LOGGER.info(
69-
f"[ephemeral] CronJob validated: schedule={spec.schedule}, concurrency={spec.concurrencyPolicy}"
70-
)
62+
LOGGER.info(f"[ephemeral] CronJob validated: schedule={spec.schedule}, concurrency={spec.concurrencyPolicy}")
7163

7264
@pytest.mark.tier1
7365
def test_cleanup_networkpolicy_exists(self, admin_client: DynamicClient) -> None:
@@ -143,9 +135,7 @@ def test_create_ephemeral_key(
143135
f"Expected 200 from default search, got {r_default.status_code}: {(r_default.text or '')[:200]}"
144136
)
145137
default_body = r_default.json()
146-
default_items: list[dict[str, Any]] = (
147-
default_body.get("items") or default_body.get("data") or []
148-
)
138+
default_items: list[dict[str, Any]] = default_body.get("items") or default_body.get("data") or []
149139
assert key_id not in [item["id"] for item in default_items], (
150140
"Ephemeral key should be excluded from default search (includeEphemeral defaults to False)"
151141
)
@@ -187,9 +177,7 @@ def test_trigger_cleanup_preserves_active_keys(
187177
)
188178
cleanup_resp = cleanup_response.json()
189179
deleted_count = cleanup_resp.get("deletedCount", -1)
190-
assert deleted_count >= 0, (
191-
f"Cleanup response should have non-negative deletedCount, got: {cleanup_resp}"
192-
)
180+
assert deleted_count >= 0, f"Cleanup response should have non-negative deletedCount, got: {cleanup_resp}"
193181
LOGGER.info(f"[ephemeral] Cleanup completed: deletedCount={deleted_count}")
194182

195183
r_get = request_session_http.get(

0 commit comments

Comments
 (0)