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(integration): fix three more CircleCI integration reds from test setup (#46510)

yuneng-jiangf95e466bb7af
diff --git a/tests/integration/providers/test_voyage_mongodb_host_wire.py b/tests/integration/providers/test_voyage_mongodb_host_wire.py
index 926bd5a7c69..273020d48a8 100644
--- a/tests/integration/providers/test_voyage_mongodb_host_wire.py
+++ b/tests/integration/providers/test_voyage_mongodb_host_wire.py
@@ -131,7 +131,12 @@ def _scrubbed() -> tuple[str, ...]:
def _forward_environment(forward_url: str, **extra: str) -> dict[str, str]:
- return {"HTTPS_PROXY": forward_url, "NO_PROXY": "127.0.0.1,localhost", **extra}
+ return {
+ "HTTPS_PROXY": forward_url,
+ "NO_PROXY": "127.0.0.1,localhost",
+ "PROXY_BATCH_POLLING_ENABLED": "false",
+ **extra,
+ }
@pytest.fixture(scope="module")
diff --git a/tests/integration/routing/test_team_model_tpm_limit.py b/tests/integration/routing/test_team_model_tpm_limit.py
index 741c41c9285..22a4e5f54ba 100644
--- a/tests/integration/routing/test_team_model_tpm_limit.py
+++ b/tests/integration/routing/test_team_model_tpm_limit.py
@@ -13,6 +13,7 @@ PROVIDER_MODEL: Final = "gpt-4o-mini"
TEAM_MODEL_TPM: Final = 100
MAX_TOKENS: Final = 60
CONCURRENT_REQUESTS: Final = 3
+UPSTREAM_USAGE: Final = {"prompt_tokens": 10, "completion_tokens": 4, "total_tokens": 14}
UPSTREAM_REPLY: Final = json.dumps(
{
"id": "chatcmpl-team-tpm-control",
@@ -22,7 +23,7 @@ UPSTREAM_REPLY: Final = json.dumps(
"choices": [
{"index": 0, "message": {"role": "assistant", "content": "team tpm control"}, "finish_reason": "stop"}
],
- "usage": {"prompt_tokens": 10, "completion_tokens": 4, "total_tokens": 14},
+ "usage": UPSTREAM_USAGE,
}
).encode()
@@ -78,12 +79,16 @@ def test_concurrent_team_model_tpm_requests_reserve_tokens_before_reaching_the_p
)
release.set()
responses: Final = tuple(future.result(timeout=15) for future in futures)
- statuses: Final = tuple(sorted(response.status_code for response in responses))
- assert statuses == (200, 429, 429), tuple(response.text for response in responses)
- assert len(wire.drain()) == 1, statuses
- served: Final = next(response for response in responses if response.status_code == 200)
- assert served.json()["usage"] == {"prompt_tokens": 10, "completion_tokens": 4, "total_tokens": 14}, served.text
- for rejected in (response for response in responses if response.status_code == 429):
- error: Final = rejected.json()["error"]
- assert (error["type"], error["code"], error["param"]) == ("throttling_error", "429", None), rejected.text
- assert f"Limit type: tokens. Current limit: {TEAM_MODEL_TPM}," in error["message"], rejected.text
+ served: Final = tuple(response for response in responses if response.status_code == 200)
+ rejected: Final = tuple(response for response in responses if response.status_code != 200)
+ assert len(served) <= 1, tuple(response.text for response in responses)
+ assert len(wire.drain()) == len(served), tuple(response.status_code for response in responses)
+ for response in rejected:
+ assert response.status_code == 429, response.text
+ error: Final = response.json()["error"]
+ assert (error["type"], error["code"], error["param"]) == ("throttling_error", "429", None), response.text
+ assert f"Limit type: tokens. Current limit: {TEAM_MODEL_TPM}," in error["message"], response.text
+ admitted: Final = served[0] if served else send(CONCURRENT_REQUESTS)
+ assert admitted.status_code == 200, admitted.text
+ assert admitted.json()["usage"] == UPSTREAM_USAGE, admitted.text
+ assert len(wire.drain()) == (0 if served else 1)
diff --git a/tests/integration/translation/chat_completions/bases/openrouter.py b/tests/integration/translation/chat_completions/bases/openrouter.py
index 4823e01cc28..48c189b1d42 100644
--- a/tests/integration/translation/chat_completions/bases/openrouter.py
+++ b/tests/integration/translation/chat_completions/bases/openrouter.py
@@ -57,10 +57,11 @@ CLAUDE_SONNET_4_TEST_CASE: Final = TranslationTestCase(
"provider_specific_fields": {
"reasoning": CLAUDE_SONNET_4_MESSAGE["reasoning"],
"reasoning_details": CLAUDE_SONNET_4_MESSAGE["reasoning_details"],
- "refusal": CLAUDE_SONNET_4_MESSAGE["refusal"],
},
+ "refusal": CLAUDE_SONNET_4_MESSAGE["refusal"],
},
"finish_reason": "stop",
+ "logprobs": CLAUDE_SONNET_4_CHOICE["logprobs"],
"provider_specific_fields": {
"native_finish_reason": CLAUDE_SONNET_4_CHOICE["native_finish_reason"],
},
@@ -74,6 +75,7 @@ CLAUDE_SONNET_4_TEST_CASE: Final = TranslationTestCase(
},
},
"provider": CLAUDE_SONNET_4_RESPONSE["provider"],
+ "system_fingerprint": CLAUDE_SONNET_4_RESPONSE["system_fingerprint"],
},
)
@@ -132,10 +134,11 @@ GEMINI_3_1_FLASH_IMAGE_TEST_CASE: Final = TranslationTestCase(
"provider_specific_fields": {
"reasoning": GEMINI_3_1_FLASH_IMAGE_MESSAGE["reasoning"],
"reasoning_details": GEMINI_3_1_FLASH_IMAGE_MESSAGE["reasoning_details"],
- "refusal": GEMINI_3_1_FLASH_IMAGE_MESSAGE["refusal"],
},
+ "refusal": GEMINI_3_1_FLASH_IMAGE_MESSAGE["refusal"],
},
"finish_reason": "stop",
+ "logprobs": GEMINI_3_1_FLASH_IMAGE_CHOICE["logprobs"],
"provider_specific_fields": {
"native_finish_reason": GEMINI_3_1_FLASH_IMAGE_CHOICE["native_finish_reason"],
},
@@ -149,6 +152,7 @@ GEMINI_3_1_FLASH_IMAGE_TEST_CASE: Final = TranslationTestCase(
},
},
"provider": GEMINI_3_1_FLASH_IMAGE_RESPONSE["provider"],
+ "system_fingerprint": GEMINI_3_1_FLASH_IMAGE_RESPONSE["system_fingerprint"],
"service_tier": GEMINI_3_1_FLASH_IMAGE_RESPONSE["service_tier"],
},
)