test(integration): fix three more CircleCI integration reds from test setup (#46510)

OpenRouter basic translation expected the pre-#44788 response shape. Read
refusal, logprobs and system_fingerprint from the fixture at their new
positions.

The team model TPM test required exactly one of three concurrent requests
to be served. The pipelined limiter can reject all of them, which is an
accepted trade-off, so assert no over-admission and that a lone retry is
served when the burst got nothing.

The Voyage host tests count every host their proxy dials. The responses
cost poller could dial api.openai.com for background-response rows that
other tests left in the shared worker database, so turn polling off in
those proxies.
This commit is contained in:
yuneng-jiang 2026-10-14 15:23:14 -07:00 • committed by GitHub
parent 2310daef7e
commit f95e466bb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 13 deletions

View file

@ -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")

View file

@ -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)

View file

@ -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"],
},
)