Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test(e2e): read a deleted key back as deleted, not as a 404

yuneng-berri44a0e16c818c
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