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.
This commit is contained in:
yuneng-berri 2026-09-17 02:38:27 +00:00
parent 351a54e849
commit 44a0e16c81
No known key found for this signature in database
2 changed files with 3 additions and 11 deletions

View file

@ -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)

View file

@ -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