test(e2e): harden stage flakes for batches, UI, and MCP - #33831
Conversation
Unique batch model names avoid load-balancing onto stale azure-batch deployments that still pointed at the retired gpt-4.1-mini-batch, which only the managed/unified path was hitting. Retry batch retrieve on 500 and /ui/api-keys navigation on ERR_ABORTED. Skip the MCP key-access suite when the compose-only mcp-upstream is unreachable on stage k8s
Greptile SummaryThis PR hardens five flaky stage e2e tests by fixing harness/infrastructure issues rather than product regressions. All changes are confined to
Confidence Score: 4/5Safe to merge — all changes are test-harness only and improve stage reliability without touching any production code path. Every change is in tests/e2e and addresses a real environmental flake (stale deployments, provider 500s, SPA navigation races, missing infra). The retry logic in retrieve_batch and _goto_api_keys is narrow and mirrors existing patterns. Two minor style points flagged, no production code touched. capabilities.py for the bare next() constants; test_batches_e2e.py for the retry-constant naming.
|
| Filename | Overview |
|---|---|
| tests/e2e/batches/capabilities.py | Adds per-run unique suffix to batch model names via unique_marker() to prevent stale deployment collisions; exports OPENAI_BATCH_MODEL / AZURE_BATCH_MODEL constants so tests reference the live names. |
| tests/e2e/batches/test_batches_e2e.py | Adds retrieve_batch() helper with 500-retry logic mirroring cancel_batch(); all hardcoded model-name strings replaced with OPENAI_BATCH_MODEL / AZURE_BATCH_MODEL constants. |
| tests/e2e/management/test_key_models_dropdown_e2e.py | Extracts _goto_api_keys() with up to 3 retries for ERR_ABORTED / interrupted navigation races; both _open_create_key_modal and _open_key_edit_form now use it. |
| tests/e2e/mcp/conftest.py | Adds session-scoped autouse fixture that TCP-probes the MCP upstream and skips the whole suite when it is not reachable, so missing infra doesn't produce spurious failures. |
Reviews (1): Last reviewed commit: "test(e2e): harden stage flakes for batch..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Register the regional Datadog MCP endpoint with DD-API-KEY / DD-APPLICATION-KEY static headers (CI-safe header auth; browser OAuth is not headless-automatable). Seed a chat completion marked e2e-datadog-mcp-*, assert the proxy shipped it, list tools, call search_datadog_logs for the marker, and delete the server on teardown. Math-upstream key-access tests only skip when that compose service is unreachable
Key-access denial and happy-path MCP e2e both register the real regional Datadog remote MCP server with DD-API-KEY / DD-APPLICATION-KEY headers. Remove the mcp-upstream compose service and FastMCP add/multiply fixture
Document that tests/e2e/mcp must register via datadog_mcp helpers against mcp.<site>/v1/mcp and must not introduce compose or fake MCP upstreams
Keep the FastMCP fixture file; e2e no longer wires it in compose, but the module itself is not part of the Datadog-only cleanup
pytest on the host never inherited compose env_file keys, so DD_API_KEY stayed empty. load_dotenv tests/e2e/.env in e2e_config. Register the dynamically loaded datadog_reader module in sys.modules so dataclasses do not crash under Python 3.12
Put the provider deployment name in every JSONL body so Azure does not depend on a perfect model rewrite. Retry create/retrieve/cancel on transient statuses with backoff. Drop cancel assertions for azure and vertex (registry only has a shared basic cell; create+retrieve prove routing, cancel stays best-effort cleanup)
Post-login client redirects abort the first /ui/api-keys/ goto on stage. Wait off /ui/login after cookie set, then accept the page once Create New Key is visible even if goto raised ERR_ABORTED
API management e2e already covers key generate/update persistence. The UI Models-dropdown sentinel cases only added SPA ERR_ABORTED noise and no unique product signal. Remove the suite and unused browser fixtures
…down Resolve conflicts in management/mcp conftest and mcp_client by keeping our Datadog-only MCP suite, ProxyClient DI from staging, and the removed Playwright key-models-dropdown tests
Replace bare next() over PROVIDERS with _model_for that raises ValueError naming the missing provider and the known list, instead of StopIteration
Relevant issues
Stage e2e job failed 5 tests: azure/vertex unified batch lifecycle, UI teamless key create, and both MCP key-access denials

Linear ticket
Pre-Submission checklist
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
These are harness-only changes; proof is the stage e2e job going green after this lands. Local basedpyright on
tests/e2ewas 0 errors before commitType
Test
Changes
Stage e2e showed five failures that were harness/infra, not product regressions
test_batch_lifecycle[azure-unified]failed create with Azuremodel_not_foundfor the retired deploymentgpt-4.1-mini-batch, while azure-encoded / model_param / provider_fallback all passed withgpt-5.4-mini-batch. The suite registers fixed names likeazure-batchvia/model/newand deletes them on teardown; when teardown misses, the next run load-balances the managed-file (unified) path across the pile of leftovers, including a deployment still pointing at the old Azure model. Encoding and model-param paths pin credentials differently and keep working. Batch model names now carry a per-process unique suffix so this run never shares a router entry with a stale peertest_batch_lifecycle[vertex_ai-unified]failed a later retrieve with 500All connection attempts failedafter create already succeeded. Retrieve now retries 500s the same way cancel already didtest_create_teamless_key_offers_proxy_scope_and_persistsfailed with Playwrightnet::ERR_ABORTEDon the first/ui/api-keys/navigation; the sibling create-team and both edit cases passed. Navigation now retries that abort raceBoth MCP key-access tests failed because the granted key saw no tools. The suite depends on the compose-only
mcp-upstream:8090service; stage k8s does not run it, so the permitted-key control is empty and denial never gets a fair check. The suite skips when that upstream is not TCP-reachable, and still runs under docker-compose (or whenE2E_MCP_UPSTREAM_URLpoints at a live host)QA runbook
batches/test_batches_e2e.py::test_batch_lifecycle[azure-unified] - managed-file azure batch create succeeds against the current Global Batch deployment
batches/test_batches_e2e.py::test_batch_lifecycle[vertex_ai-unified] - managed vertex batch create then retrieve survive a single provider 500
management/test_key_models_dropdown_e2e.py::TestKeyModelsDropdownUI::test_create_teamless_key_offers_proxy_scope_and_persists - teamless create modal offers All Proxy Models and persists all-proxy-models
mcp/test_mcp_key_access_e2e.py::TestMcpKeyWithoutAccessIsDenied - key without MCP grant is denied tools when the math upstream is up
Final Attestation