From 44a0e16c818ce7b6ccb43f71f6a77348ff589c9d Mon Sep 17 00:00:00 2001 From: yuneng-berri Date: Thu, 17 Sep 2026 02:38:27 +0000 Subject: [PATCH] test(e2e): read a deleted key back as deleted, not as a 404 /key/info now serves a deleted key from the archive with status deleted instead of answering 404, so the delete test's convergence predicate never settled and the read timed out against a 200 it kept discarding. The predicate now waits for status deleted through the same _key_info_everywhere helper the rest of the file uses, and KeyInfo carries the status field. The chat-rejection assertion after it is unchanged, so the test still proves the key stops serving. --- tests/e2e/management/test_key_lifecycle_e2e.py | 13 ++----------- tests/e2e/models.py | 1 + 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/tests/e2e/management/test_key_lifecycle_e2e.py b/tests/e2e/management/test_key_lifecycle_e2e.py index 4c8effc4d24..fb153f2a7f3 100644 --- a/tests/e2e/management/test_key_lifecycle_e2e.py +++ b/tests/e2e/management/test_key_lifecycle_e2e.py @@ -22,7 +22,7 @@ from typing import Final import pytest from e2e_config import unique_marker -from e2e_http import Result, StreamingResponse, Success, UnknownApiError, unwrap +from e2e_http import Result, StreamingResponse, Success, unwrap from lifecycle import ResourceManager from management_client import MODEL_ACCESS_DENIED_MARKER, ManagementClient from models import ( @@ -135,10 +135,6 @@ def _key_info_everywhere( return MappingProxyType({replica: unwrap(read).info for replica, read in reads.items()}) -def _is_key_not_found(result: Result[KeyInfoResponse]) -> bool: - return isinstance(result, UnknownApiError) and result.status_code == 404 - - def _assert_reads_back(info: KeyInfo, expected: KeyGenerateBody, replica: str) -> None: for field, observed, wanted in ( ("key_alias", info.key_alias, expected.key_alias), @@ -290,10 +286,5 @@ class TestKeyLifecycle: client.delete_key_strict(created.key) - _ = client.proxy.read_back_everywhere( - "/key/info", - params=KeyInfoParams(key=created.key), - response_type=KeyInfoResponse, - converged=_is_key_not_found, - ) + _ = _key_info_everywhere(client, created.key, lambda info: info.status == "deleted") _assert_chat_rejected_everywhere(client, created.key, mock_deployment) diff --git a/tests/e2e/models.py b/tests/e2e/models.py index 7550bfdc150..9f49c5974d0 100644 --- a/tests/e2e/models.py +++ b/tests/e2e/models.py @@ -136,6 +136,7 @@ class LiteLLMBudgetTable(BaseModel): class KeyInfo(BaseModel): key_alias: str | None = None + status: str | None = None metadata: KeyMetadata | None = None models: list[str] = [] tpm_limit: int | None = None