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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(e2e): unblock the ui suite, fix the mcp registration race, park two known product bugs (#34853)
mubashir1osmani328e41b1f936
diff --git a/tests/e2e/llm_translation/test_messages_mid_conversation_system_e2e.py b/tests/e2e/llm_translation/test_messages_mid_conversation_system_e2e.pyindex 4b3191e60bb..fff2109b0cf 100644--- a/tests/e2e/llm_translation/test_messages_mid_conversation_system_e2e.py+++ b/tests/e2e/llm_translation/test_messages_mid_conversation_system_e2e.py@@ -145,7 +145,18 @@ def _prime_prompt_cache(time.sleep(CACHE_PRIMING_INTERVAL_SECONDS)+#: Kept in sync with the copy in test_messages_mid_conversation_system_native_providers_e2e.py;+#: the e2e suites stay self-contained rather than importing across test modules.+MID_CONVERSATION_CACHE_SKIP_REASON = (+ "LIT-4873: a mid-conversation role='system' reminder invalidates the prompt cache on the "+ "vertex_ai / azure_ai / bedrock_invoke Messages paths, while the same request preserves it "+ "both direct to Anthropic and through litellm's first-party anthropic path. Product bug, not "+ "a test defect: the assertion here is correct and must be restored unchanged with the fix"+)++class TestBedrockInvokeMidConversationSystem:+ @pytest.mark.skip(reason=MID_CONVERSATION_CACHE_SKIP_REASON)@pytest.mark.covers("llm.messages.bedrock_invoke.mid_conversation_system.nonstream.cache_hit",exercised_on=[],diff --git a/tests/e2e/llm_translation/test_messages_mid_conversation_system_native_providers_e2e.py b/tests/e2e/llm_translation/test_messages_mid_conversation_system_native_providers_e2e.pyindex 97d24e0564b..35ed3dc881a 100644--- a/tests/e2e/llm_translation/test_messages_mid_conversation_system_native_providers_e2e.py+++ b/tests/e2e/llm_translation/test_messages_mid_conversation_system_native_providers_e2e.py@@ -155,6 +155,24 @@ def _prime_prompt_cache(time.sleep(CACHE_PRIMING_INTERVAL_SECONDS)+#: Why the flagged-model cache checks are skipped rather than failing. The+#: assertions below are correct and must be restored unchanged when the bug is+#: fixed; they are the regression guard for a real billing cost.+#:+#: Measured cache_read_input_tokens on the reminder turn, same conversation shape:+#: direct to api.anthropic.com 7013 preserved+#: litellm -> anthropic/claude-opus-4-8 7013 preserved+#: litellm -> vertex_ai/claude-opus-4-8 0 destroyed+#: and the Vertex control with the same added turns but no reminder reads 7013,+#: so it is the reminder on the non-first-party paths, not the extra turns.+MID_CONVERSATION_CACHE_SKIP_REASON = (+ "LIT-4873: a mid-conversation role='system' reminder invalidates the prompt cache on the "+ "vertex_ai / azure_ai / bedrock_invoke Messages paths, while the same request preserves it "+ "both direct to Anthropic and through litellm's first-party anthropic path. Product bug, not "+ "a test defect: the assertion here is correct and must be restored unchanged with the fix"+)++def _assert_flagged_model_keeps_cache(client: EndpointsClient, resources: ResourceManager, params: LiteLLMParamsBody) -> None:@@ -218,6 +236,7 @@ class TestAzureFoundryMidConversationSystem:FLAGGED_MODEL = "azure_ai/claude-opus-4-8"UNFLAGGED_MODEL = "azure_ai/claude-opus-4-7"+ @pytest.mark.skip(reason=MID_CONVERSATION_CACHE_SKIP_REASON)@pytest.mark.covers("llm.messages.azure_foundry.mid_conversation_system.nonstream.cache_hit",exercised_on=[],@@ -243,6 +262,7 @@ class TestVertexMidConversationSystem:FLAGGED_MODEL = "vertex_ai/claude-opus-4-8"UNFLAGGED_MODEL = "vertex_ai/claude-sonnet-4-6"+ @pytest.mark.skip(reason=MID_CONVERSATION_CACHE_SKIP_REASON)@pytest.mark.covers("llm.messages.vertex.mid_conversation_system.nonstream.cache_hit",exercised_on=[],diff --git a/tests/e2e/ui/constants.ts b/tests/e2e/ui/constants.tsindex 17adb0f5fce..9d918736262 100644--- a/tests/e2e/ui/constants.ts+++ b/tests/e2e/ui/constants.ts@@ -1,15 +1,28 @@+import * as path from "path";+export const UI_BASE_URL = (process.env.E2E_UI_BASE_URL ||process.env.LITELLM_PROXY_URL ||"http://localhost:4000").replace(/\/+$/, "");+// Directory every artifact this suite writes must land in: storage states,+// failure screenshots, playwright output. A local `./run_e2e.sh` run has a+// writable cwd, so it keeps the historical behavior of writing beside the+// suite. In the packaged e2e image the suite ships on a read-only filesystem+// (/app/e2e/ui), so bare relative paths raise EROFS/ENOENT and the run dies in+// globalSetup before a single test executes. Point E2E_UI_ARTIFACT_DIR at a+// writable path (the image runner already exports TMPDIR) to relocate them.+export const ARTIFACT_DIR = process.env.E2E_UI_ARTIFACT_DIR || ".";++const storagePath = (name: string): string => path.join(ARTIFACT_DIR, name);+// Storage state paths for each role-export const ADMIN_STORAGE_PATH = "admin.storageState.json";-export const ADMIN_VIEWER_STORAGE_PATH = "adminViewer.storageState.json";-export const INTERNAL_USER_STORAGE_PATH = "internalUser.storageState.json";-export const INTERNAL_VIEWER_STORAGE_PATH = "internalViewer.storageState.json";-export const TEAM_ADMIN_STORAGE_PATH = "teamAdmin.storageState.json";+export const ADMIN_STORAGE_PATH = storagePath("admin.storageState.json");+export const ADMIN_VIEWER_STORAGE_PATH = storagePath("adminViewer.storageState.json");+export const INTERNAL_USER_STORAGE_PATH = storagePath("internalUser.storageState.json");+export const INTERNAL_VIEWER_STORAGE_PATH = storagePath("internalViewer.storageState.json");+export const TEAM_ADMIN_STORAGE_PATH = storagePath("teamAdmin.storageState.json");// Seeded user identities (match seed.sql)export const E2E_PROXY_ADMIN_USER_ID = "e2e-proxy-admin";diff --git a/tests/e2e/ui/fixtures/users.ts b/tests/e2e/ui/fixtures/users.tsindex 7d6d356cefb..731234b5ea9 100644--- a/tests/e2e/ui/fixtures/users.ts+++ b/tests/e2e/ui/fixtures/users.ts@@ -1,3 +1,11 @@+import {+ ADMIN_STORAGE_PATH,+ ADMIN_VIEWER_STORAGE_PATH,+ INTERNAL_USER_STORAGE_PATH,+ INTERNAL_VIEWER_STORAGE_PATH,+ TEAM_ADMIN_STORAGE_PATH,+} from "../constants";+export enum Role {ProxyAdmin = "proxy_admin",ProxyAdminViewer = "proxy_admin_viewer",@@ -29,10 +37,12 @@ export const users: Record<Role, { email: string; password: string }> = {},};+// Re-exported from constants so the paths have one definition; they must honor+// ARTIFACT_DIR, since the suite runs from a read-only cwd in the e2e image.export const STORAGE_PATHS: Record<Role, string> = {- [Role.ProxyAdmin]: "admin.storageState.json",- [Role.ProxyAdminViewer]: "adminViewer.storageState.json",- [Role.InternalUser]: "internalUser.storageState.json",- [Role.InternalUserViewer]: "internalViewer.storageState.json",- [Role.TeamAdmin]: "teamAdmin.storageState.json",+ [Role.ProxyAdmin]: ADMIN_STORAGE_PATH,+ [Role.ProxyAdminViewer]: ADMIN_VIEWER_STORAGE_PATH,+ [Role.InternalUser]: INTERNAL_USER_STORAGE_PATH,+ [Role.InternalUserViewer]: INTERNAL_VIEWER_STORAGE_PATH,+ [Role.TeamAdmin]: TEAM_ADMIN_STORAGE_PATH,};diff --git a/tests/e2e/ui/globalSetup.ts b/tests/e2e/ui/globalSetup.tsindex 6dae603b7cf..6068a51c88e 100644--- a/tests/e2e/ui/globalSetup.ts+++ b/tests/e2e/ui/globalSetup.ts@@ -1,12 +1,21 @@import { chromium, expect, request } from "@playwright/test";import { users, Role, STORAGE_PATHS } from "./fixtures/users";-import { UI_BASE_URL } from "./constants";+import { ARTIFACT_DIR, UI_BASE_URL } from "./constants";import * as fs from "fs";+import * as path from "path";async function globalSetup() {const browser = await chromium.launch();const rootPath = process.env.SERVER_ROOT_PATH ?? "";+ // Create the artifact root before anything writes into it. storageState() does+ // not create missing parents, so pointing E2E_UI_ARTIFACT_DIR at a path that+ // does not exist yet would fail with ENOENT on the first role's snapshot,+ // before any test ran. Playwright creates its own outputDir lazily, so this is+ // the only place that has to do it. recursive:true makes it idempotent, and+ // keeps the default "." a no-op.+ fs.mkdirSync(ARTIFACT_DIR, { recursive: true });+// The Projects sidebar item is hidden unless the enterprise-gated// enable_projects_ui setting is on, and the seeded DB starts with it off.// The proxy runs with LITELLM_LICENSE in CI, so enable it the same way@@ -47,9 +56,24 @@ async function globalSetup() {await page.context().clearCookies({ name: "litellm_return_url" });await page.context().storageState({ path: storagePath });} catch (e) {- fs.mkdirSync("test-results", { recursive: true });- await page.screenshot({ path: `test-results/global-setup-${role}-failure.png`, fullPage: true });- console.error(`Global setup failed for role ${role}. Screenshot saved. URL: ${page.url()}`);+ // Best-effort diagnostics only: this handler must never replace the real+ // failure with its own. Writing the screenshot used to throw ENOENT/EROFS+ // on the read-only cwd in the e2e image, which masked every underlying+ // login error and made the run look like a filesystem bug.+ try {+ const failureDir = path.join(ARTIFACT_DIR, "test-results");+ fs.mkdirSync(failureDir, { recursive: true });+ await page.screenshot({+ path: path.join(failureDir, `global-setup-${role}-failure.png`),+ fullPage: true,+ });+ console.error(`Global setup failed for role ${role}. Screenshot saved. URL: ${page.url()}`);+ } catch (diagnosticError) {+ console.error(+ `Global setup failed for role ${role} at URL: ${page.url()}. ` ++ `Could not save a screenshot: ${diagnosticError}`,+ );+ }throw e;} finally {await page.close();diff --git a/tests/e2e/ui/playwright.config.ts b/tests/e2e/ui/playwright.config.tsindex 8ae8ddad639..a92192f64ae 100644--- a/tests/e2e/ui/playwright.config.ts+++ b/tests/e2e/ui/playwright.config.ts@@ -1,5 +1,6 @@import { defineConfig, devices } from "@playwright/test";-import { UI_BASE_URL } from "./constants";+import * as path from "path";+import { ARTIFACT_DIR, UI_BASE_URL } from "./constants";/*** See https://playwright.dev/docs/test-configuration.@@ -17,7 +18,11 @@ export default defineConfig({/* Opt out of parallel tests on CI. */workers: process.env.CI ? 1 : undefined,/* Reporter to use. See https://playwright.dev/docs/test-reporters */- reporter: "html",+ /* The html reporter and the artifact dir both write relative to cwd, which is+ read-only in the packaged e2e image; keep them under ARTIFACT_DIR so a plain+ `npx playwright test` works there without extra flags. */+ reporter: [["html", { outputFolder: path.join(ARTIFACT_DIR, "playwright-report"), open: "never" }]],+ outputDir: path.join(ARTIFACT_DIR, "test-results"),/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */use: {/* Base URL to use in actions like `await page.goto('/')`. */