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): fail the run when a Rust gateway silently serves /messages through Python (#34208)

Yassin Kortam3f98f6274886
diff --git a/tests/e2e/e2e_config.py b/tests/e2e/e2e_config.py
index 30353b93dd6..e7c48690c0a 100644
--- a/tests/e2e/e2e_config.py
+++ b/tests/e2e/e2e_config.py
@@ -72,6 +72,8 @@ POLL_TIMEOUT = float(os.environ.get("E2E_POLL_TIMEOUT", "120"))
POLL_INTERVAL = float(os.environ.get("E2E_POLL_INTERVAL", "5"))
REQUEST_TIMEOUT = float(os.environ.get("E2E_REQUEST_TIMEOUT", "60"))
+EXPECT_RUST = os.environ.get("E2E_EXPECT_RUST", "").strip().lower() in ("1", "true", "yes")
+
LOAD_USERS = int(os.environ.get("E2E_LOAD_USERS", "750"))
LOAD_SPAWN_RATE = float(os.environ.get("E2E_LOAD_SPAWN_RATE", "50"))
LOAD_DURATION_SECONDS = float(os.environ.get("E2E_LOAD_DURATION_SECONDS", "60"))
diff --git a/tests/e2e/llm_translation/test_messages_azure_foundry_e2e.py b/tests/e2e/llm_translation/test_messages_azure_foundry_e2e.py
index 3f2907f202e..d8d44820e80 100644
--- a/tests/e2e/llm_translation/test_messages_azure_foundry_e2e.py
+++ b/tests/e2e/llm_translation/test_messages_azure_foundry_e2e.py
@@ -12,7 +12,7 @@ from __future__ import annotations
import pytest
-from e2e_config import unique_marker
+from e2e_config import EXPECT_RUST, unique_marker
from e2e_http import StreamingResponse, require_successful_call, unwrap
from endpoints_client import EndpointsClient
from lifecycle import ResourceManager
@@ -50,6 +50,13 @@ def _assert_streamed_ok(result: StreamingResponse) -> None:
assert any("message_stop" in event for event in result.stream_events), (
"stream never reached message_stop"
)
+ if EXPECT_RUST:
+ assert result.headers.get("x-litellm-rust") == "true", (
+ "E2E_EXPECT_RUST is set, so this gateway must serve /v1/messages through the "
+ "Rust path, but the response carried no x-litellm-rust marker. The request "
+ "still succeeded, which is exactly the failure mode: a gateway whose native "
+ f"extension is unavailable falls back to Python silently. headers={result.headers}"
+ )
class TestAzureFoundryMessages: