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): cover model deletion removing it from the catalog (#34006)

Yassin Kortam61b906f9b606
diff --git a/tests/e2e/management/management_client.py b/tests/e2e/management/management_client.py
index 753f787b921..0d68098d2d2 100644
--- a/tests/e2e/management/management_client.py
+++ b/tests/e2e/management/management_client.py
@@ -22,6 +22,7 @@ from models import (
KeyListResponse,
KeyRegenerateBody,
KeyUpdateBody,
+ ModelDeleteBody,
OrgDeleteBody,
OrgInfoParams,
OrgInfoResponse,
@@ -99,6 +100,18 @@ class ManagementClient:
)
)
+ def delete_model_strict(self, model_id: str) -> None:
+ """Strict delete for the act phase of a test: a failed delete is a hard
+ failure, unlike the warn-only ProxyClient.delete_model used at teardown."""
+ _ = unwrap(
+ self.proxy.transport.post(
+ "/model/delete",
+ headers=self.proxy.transport.master,
+ json=ModelDeleteBody(id=model_id),
+ response_type=NoBody,
+ )
+ )
+
def block_key(self, key: str) -> None:
_ = unwrap(
self.proxy.transport.post(
diff --git a/tests/e2e/management/test_management_e2e.py b/tests/e2e/management/test_management_e2e.py
index f0bcc354e61..4e9270bb9e5 100644
--- a/tests/e2e/management/test_management_e2e.py
+++ b/tests/e2e/management/test_management_e2e.py
@@ -439,6 +439,28 @@ class TestModelRoutes:
"after /model/update",
)
+ @pytest.mark.covers("mgmt.model.delete.persists")
+ def test_delete_removes_from_model_info_catalog(
+ self, client: ManagementClient, resources: ResourceManager
+ ) -> None:
+ """The teardown's deferred delete fires again on the already-deleted model by
+ design: it is the safety net if this test fails before the in-body delete, and
+ a repeat /model/delete is a warn-only no-op the teardown absorbs."""
+ model_name = f"e2e-mgmt-model-{unique_marker()}"
+ model_id = client.proxy.create_model(model_name, LiteLLMParamsBody(model="openai/gpt-5.5", api_key="dummy"))
+ resources.defer(lambda: client.proxy.delete_model(model_id))
+
+ assert model_name in [entry.model_name for entry in client.proxy.model_info()], (
+ f"{model_name} absent from /model/info right after /model/new; cannot prove deletion removes it"
+ )
+
+ client.delete_model_strict(model_id)
+
+ def absent() -> bool | None:
+ return True if model_name not in [entry.model_name for entry in client.proxy.model_info()] else None
+
+ _ = _poll(client, absent, f"{model_name} still present in /model/info after /model/delete at the deadline")
+
@pytest.mark.covers("mgmt.model.add.persists")
def test_new_persists_to_model_info_catalog(
self, client: ManagementClient, resources: ResourceManager