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: harden remaining pass-through CI flakes (image-gen spend poll, ruby assistants timeout) (#30685)

Mateo Wang654e354ebd84
diff --git a/tests/pass_through_tests/ruby_passthrough_tests/spec/openai_assistants_passthrough_spec.rb b/tests/pass_through_tests/ruby_passthrough_tests/spec/openai_assistants_passthrough_spec.rb
index 1cfaeb5e209..5a4dc0395f8 100644
--- a/tests/pass_through_tests/ruby_passthrough_tests/spec/openai_assistants_passthrough_spec.rb
+++ b/tests/pass_through_tests/ruby_passthrough_tests/spec/openai_assistants_passthrough_spec.rb
@@ -5,7 +5,8 @@ RSpec.describe 'OpenAI Assistants Passthrough' do
let(:client) do
OpenAI::Client.new(
access_token: "sk-1234",
- uri_base: "http://0.0.0.0:4000/openai"
+ uri_base: "http://0.0.0.0:4000/openai",
+ request_timeout: 600
)
end
diff --git a/tests/test_keys.py b/tests/test_keys.py
index 89977d43676..003e2711055 100644
--- a/tests/test_keys.py
+++ b/tests/test_keys.py
@@ -621,17 +621,23 @@ async def test_key_info_spend_values_image_generation():
assert spend > 0
# The record/replay proxy serves this identical second call from its
- # cassette (free), but the proxy must still bill it. If the proxy's own
- # response cache were on, the repeat would be a $0 cache hit and spend
- # would not move, silently zeroing recorded-call spend; assert it grows.
+ # cassette (free), but the proxy must still bill it. Spend logging is
+ # async/batched, so poll for the increase rather than reading once after a
+ # fixed sleep; a spend that never grows means the repeat was not billed
+ # (e.g. the proxy response cache is on), which this still catches.
await image_generation(session=session, key=key)
- await asyncio.sleep(5)
- key_info = await retry_request(
- get_key_info, session=session, get_key=key, call_key=key
- )
- assert key_info["info"]["spend"] > spend, (
- "spend did not increase on an identical repeat image call; the proxy "
- "response cache appears to be ON, which would zero recorded-call spend"
+ spend_after = spend
+ for _ in range(12):
+ await asyncio.sleep(5)
+ key_info = await retry_request(
+ get_key_info, session=session, get_key=key, call_key=key
+ )
+ spend_after = key_info["info"]["spend"]
+ if spend_after > spend:
+ break
+ assert spend_after > spend, (
+ "spend did not increase on an identical repeat image call; the repeat "
+ "was not billed (the proxy response cache may be on)"
)