Merge pull request #39804 from BerriAI/litellm_/e2e-wildcard-probe-and-embedding-allowlist

test(e2e): repair the wildcard readiness probe and the semantic auto-router spend assertion
This commit is contained in:
yuneng-jiang 2026-09-05 10:27:31 -07:00 committed by GitHub
commit 7672399c26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 3 deletions

View file

@ -851,6 +851,15 @@ class ModelListEntry(BaseModel):
id: str
class ModelsListParams(BaseModel):
"""Query for GET /v1/models. A wildcard route such as ``openai/gpt-5.4*`` is
listed only under ``return_wildcard_routes``; without it the route is dropped
and only its expansions remain, so a readiness poll for the pattern itself
never resolves."""
return_wildcard_routes: bool = True
class ModelsListResponse(BaseModel):
"""GET /v1/models on the data plane: the deployments the gateway can actually
serve right now. Used to confirm a freshly created model has propagated from

View file

@ -55,6 +55,7 @@ from models import (
ModelMode,
ModelNewBody,
ModelNewResponse,
ModelsListParams,
ModelsListResponse,
ModelUpdateBody,
OcrBody,
@ -336,7 +337,7 @@ class ProxyClient:
lambda poll_timeout: self.transport.get(
"/v1/models",
headers=headers,
params=NoBody(),
params=ModelsListParams(),
response_type=ModelsListResponse,
timeout=poll_timeout,
),

View file

@ -597,9 +597,20 @@ class TestSemanticAutoRouterResponses:
)
)
assert answer.id, "/v1/responses through the semantic auto-router returned no response id"
rows: Final = proxy.poll_logs_for_key(key, min_rows=1)
rows: Final = proxy.poll_logs_for_key(
key,
min_rows=2,
predicate=lambda logged: any(row.model == EMBEDDING_MODEL for row in logged),
)
embedding_rows: Final = tuple(row for row in rows if row.model == EMBEDDING_MODEL)
assert embedding_rows, (
"the routing embedding was not billed to the caller's key; "
f"spend logs show {tuple(row.model for row in rows)}"
)
_assert_served_only_by(
rows, CHEAP_SERVED | {semantic_auto_router.target}, "semantic auto-router /v1/responses string input"
[row for row in rows if row.model != EMBEDDING_MODEL],
CHEAP_SERVED | {semantic_auto_router.target},
"semantic auto-router /v1/responses string input",
)