litellm/tests/unit/llms/vertex_ai
yuneng-jiang ff281dbd14
test(unit): make 21 flaky unit tests deterministic (#54785)
* test(unit): make 20 flaky unit tests deterministic

These tests failed on main and on PR reruns over the last two weeks without a code change. Each fix keeps
what the test proves and only removes the timing, clock or shared-state dependency.

Router usage tests now read usage with usage_since, because the Rust core stamps usage with its own system
clock, so a read in the next minute missed the write. The header parity test checks the remaining count
against the minute the header was read in. The websocket admission test pins the usage-based-routing-v2
clock, and the deployment rpm test freezes time with time-machine because its old patch never reached the
clock bound as a default argument.

The bedrock realtime test stubs AWS signing like its sibling. The swagger test stubs FastAPI's schema
builder. The prisma span scan skips files that cannot hold a call site. The http, live session and custom
code bounds are tied to the timeout constants they guard.

The vertex test reads only LiteLLM log records, the agentops test reads only its own route's requests, the
redis test picks a port whose shared breaker is closed, and the SAML test freezes the clock and now asserts
the exact TTL.

* test(bedrock): stub the boto3 session instead of our own signing helper

Greptile flagged that the realtime guardrail fixture replaced run_aws_signing, which tests/unit/AGENTS.md
forbids. The CI timeout was resolve_credentials building a real boto3.Session on the signing pool, so the
fixture now swaps boto3.Session for a static-key session and the real signing path runs.

* test(s3): keep the short upload deadline for the timeout case only

The dropped-connection case also ran under the 0.3s per-attempt deadline. When the fake bucket's handler
thread answered one attempt late on a loaded runner, that attempt was retried as a timeout instead of a
dropped connection, so the test counted 5 PUTs instead of 6. Only the timeout case needs the short deadline.
2026-11-26 20:48:13 -08:00
..
agent_engine
audio_transcription feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
batches feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
context_caching fix(vertex_ai): cache the whole conversation prefix up to the cache_control block so Gemini sees turns in order (#54434) 2026-11-25 21:26:15 +00:00
count_tokens ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
files fix(gemini): return raw pcm16 when Gemini TTS answers WAV audio (#51145) 2026-11-24 08:45:12 -08:00
fine_tuning
fixtures
gemini fix(vertex_ai): cache the whole conversation prefix up to the cache_control block so Gemini sees turns in order (#54434) 2026-11-25 21:26:15 +00:00
gemini_embeddings fix(embeddings): send request-shaped extra_body fields at the provider's documented path (#54273) 2026-11-25 13:29:52 -08:00
image_edit fix(vertex-ai): raise BadRequestError instead of ValueError in VertexAIImagenImageEditConfig (#52538) 2026-11-25 21:15:29 -08:00
image_generation fix(gemini): return an error instead of an empty 200 when a Gemini image request gets no image (#29125) 2026-11-25 20:55:23 +00:00
interactions feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
multimodal_embeddings fix(embeddings): send request-shaped extra_body fields at the provider's documented path (#54273) 2026-11-25 13:29:52 -08:00
rag_engine
realtime feat(gemini): support Gemini Live Avatar on Vertex AI realtime (#53270) 2026-11-21 15:06:59 -08:00
rerank feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
responses feat(vertex_ai): add Meta Muse models on Vertex AI (#50768) 2026-11-21 13:00:24 -08:00
text_to_speech fix(vertex_ai): honor vertex_location for the Cloud Text-to-Speech endpoint (#50255) 2026-11-06 00:03:17 -08:00
vertex_ai_partner_models fix(anthropic): drop unsigned thinking blocks before /v1/messages reaches Claude (#51793) 2026-11-24 05:30:55 +00:00
vertex_embeddings fix(embeddings): send request-shaped extra_body fields at the provider's documented path (#54273) 2026-11-25 13:29:52 -08:00
vertex_gemma_models
videos feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
__init__.py
google_genai_proxy_test_config.yaml
test_bge_embedding.py
test_bge_response_transformation.py
test_common_utils.py
test_gemini_batch_embeddings.py
test_gemini_empty_properties.py
test_gemini_header_forwarding.py
test_http_status_201.py
test_request_labels.py feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
test_vertex.py feat(messages): serve vertex ai claude messages on rust only (#52314) 2026-11-19 21:15:10 +00:00
test_vertex_ai_batch_transformation.py
test_vertex_ai_common_utils.py fix(messages): answer 400 for a non-string user or system text block and keep count_tokens in step with inference (#54165) 2026-11-25 00:48:41 +00:00
test_vertex_ai_non_gemini.py
test_vertex_ai_psc_endpoint_support.py
test_vertex_ai_search_vector_store_transformation.py
test_vertex_gemini_gcs_uri_mime.py
test_vertex_global_url_support.py
test_vertex_image_generation.py
test_vertex_llm_base.py test(unit): make 21 flaky unit tests deterministic (#54785) 2026-11-26 20:48:13 -08:00
test_vertex_model_garden_openapi.py fix(openai_like): honor the deployment timeout and stream_timeout on async streams (#53442) 2026-11-22 21:52:59 +00:00
test_vertex_passthrough_logging_handler.py