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
test(pass_through): harden vertex spendlog poll against transient empty reads (#30683)
Mateo Wang4ccc32312dbd
diff --git a/tests/pass_through_tests/test_vertex_ai.py b/tests/pass_through_tests/test_vertex_ai.pyindex 0ac66b470c6..e8223f2219c 100644--- a/tests/pass_through_tests/test_vertex_ai.py+++ b/tests/pass_through_tests/test_vertex_ai.py@@ -126,15 +126,21 @@ async def test_basic_vertex_ai_pass_through_with_spendlog():print("response", response)- # Poll for spend update instead of fixed sleep - spend logging is async/batched- max_wait = 120 # total seconds to wait+ # Spend logging is async/batched and can lag under CI load, so poll instead of+ # sleeping a fixed amount. A transient empty read is skipped, not counted as 0.0+ # spend, which would spuriously fail the assertion on an otherwise-billed call.+ max_wait = 240 # total seconds to waitpoll_interval = 10 # seconds between checkselapsed = 0spend_after = spend_beforewhile elapsed < max_wait:await asyncio.sleep(poll_interval)elapsed += poll_interval- spend_after = await call_spend_logs_endpoint() or 0.0+ latest_spend = await call_spend_logs_endpoint()+ if latest_spend is None:+ print(f"spend logs unavailable (elapsed={elapsed}s), retrying")+ continue+ spend_after = latest_spendprint(f"spend_after (elapsed={elapsed}s)", spend_after)if spend_after > spend_before:break