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
fix(e2e): make spend-counter redis connection env-driven for non-cluster deployments (#35732)
yuneng-jiang5ac1edcd5944
diff --git a/tests/e2e/CONTRIBUTING.md b/tests/e2e/CONTRIBUTING.mdindex fc43769aca8..5999e5772d1 100644--- a/tests/e2e/CONTRIBUTING.md+++ b/tests/e2e/CONTRIBUTING.md@@ -25,7 +25,7 @@ The suites run against a live proxy, so bring one up first by running the litellGEMINI_API_KEY="..."```-2. Bring up a Postgres and a Redis for the proxy to use. The repo-root `docker-compose.yml` already defines a Postgres on `5432`; a `docker run -p 6379:6379 redis:7` covers Redis. Point `DATABASE_URL` / `REDIS_HOST` / `REDIS_PORT` at whatever you run+2. Bring up a Postgres and a Redis for the proxy to use. The repo-root `docker-compose.yml` already defines a Postgres on `5432`; a `docker run -p 6379:6379 redis:7` covers Redis. Point `DATABASE_URL` / `REDIS_HOST` / `REDIS_PORT` at whatever you run. Tests that read Redis directly default to the deployed shape (TLS + cluster mode) whenever `REDIS_HOST` is set, so for a local standalone Redis also set `REDIS_CLUSTER=false` and `REDIS_SSL=false` (plus `REDIS_PASSWORD` when your Redis requires auth)3. Start the litellm proxy locally against your config and confirm it is live:diff --git a/tests/e2e/quota_management/budgets/test_spend_counter_reseed_e2e.py b/tests/e2e/quota_management/budgets/test_spend_counter_reseed_e2e.pyindex d9f9830ee20..7cfd3e33fd6 100644--- a/tests/e2e/quota_management/budgets/test_spend_counter_reseed_e2e.py+++ b/tests/e2e/quota_management/budgets/test_spend_counter_reseed_e2e.py@@ -46,22 +46,43 @@ COLD_WAIT_SECONDS = 80_JSON_FLOAT: TypeAdapter[float] = TypeAdapter(float)+def _redis_flag(name: str, default: str) -> bool:+ return os.environ.get(name, default).strip().lower() in ("1", "true", "yes")++def _redis() -> "redis.Redis[str] | RedisCluster[str]":- """The proxy's Redis. The deployed runner sets REDIS_HOST to the serverless- ElastiCache, which is always TLS + cluster-mode; without it, fall back to a- local standalone redis for docker-compose runs."""+ """The proxy's Redis. With REDIS_HOST set, TLS and cluster mode default to+ on (the stage runner's serverless ElastiCache) and are overridable with+ REDIS_SSL / REDIS_CLUSTER, plus REDIS_PASSWORD when auth is enabled, so the+ same test runs against a standalone redis like the ephemeral per-SHA+ stack's bundled one. Without REDIS_HOST, fall back to a local standalone+ redis for docker-compose runs."""import redishost = os.getenv("REDIS_HOST")if not host:return redis.Redis(host="localhost", port=6380, decode_responses=True, socket_connect_timeout=2)+ port = int(os.getenv("REDIS_PORT", "6379"))+ use_ssl = _redis_flag("REDIS_SSL", "true")+ password = os.getenv("REDIS_PASSWORD") or None+ if not _redis_flag("REDIS_CLUSTER", "true"):+ return redis.Redis(+ host=host,+ port=port,+ ssl=use_ssl,+ password=password,+ decode_responses=True,+ socket_connect_timeout=2,+ )+from redis.cluster import RedisClusterreturn RedisCluster(host=host,- port=int(os.getenv("REDIS_PORT", "6379")),- ssl=True,+ port=port,+ ssl=use_ssl,+ password=password,decode_responses=True,socket_connect_timeout=2,)