litellm/tests/unit/integrations/otel
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
..
__init__.py
test_db_endpoint.py fix(otel): name postgres service spans by operation and table (#44240) 2026-10-03 09:20:28 -07:00
test_langfuse_logger.py fix(responses): preserve incomplete status in synthetic streams (#52489) 2026-11-19 22:24:50 -08:00
test_otel_v2_baggage.py feat(otel): add Mixpanel OpenTelemetry v2 preset callback (#49999) 2026-11-25 10:27:02 -08:00
test_otel_v2_components.py feat(control_plane): ocsf audit events, sink protocol, queued delivery and hash chain (#49660) 2026-11-16 17:36:24 +00:00
test_otel_v2_config_baggage_parenting_guardrails.py fix(otel): tolerate non-dict callback_settings.otel and ignore bare EXCLUDED_SERVICES env (#44086) 2026-10-02 12:36:46 -07:00
test_otel_v2_destinations.py feat(otel): add Mixpanel OpenTelemetry v2 preset callback (#49999) 2026-11-25 10:27:02 -08:00
test_otel_v2_dynamic.py feat(langfuse_otel): group calls that share a metadata trace_id into one trace (#54408) 2026-11-26 00:58:20 +00:00
test_otel_v2_emitter.py fix(langfuse otel): emit request metadata under langfuse.observation.metadata and langfuse.trace.metadata on the OTEL v2 Langfuse mapper (#42697) 2026-10-27 18:54:10 -07:00
test_otel_v2_logger.py feat(otel): add option to disable background service spans (#54478) 2026-11-25 12:28:04 -08:00
test_otel_v2_metrics.py fix(otel): label configured pass-through routes litellm.passthrough and read the operation from the upstream (#48675) 2026-10-28 10:48:34 -07:00
test_otel_v2_mount.py fix(otel): suppress spans for excluded proxy requests (#48720) 2026-10-28 11:24:34 -07:00
test_otel_v2_multibackend.py
test_otel_v2_named_trace.py feat(langfuse_otel): group calls that share a metadata trace_id into one trace (#54408) 2026-11-26 00:58:20 +00:00
test_otel_v2_presets.py test(unit): make 21 flaky unit tests deterministic (#54785) 2026-11-26 20:48:13 -08:00
test_otel_v2_sources_of_truth.py fix(otel): send the Langfuse environment, release and version on OTel v2 (#51385) 2026-11-14 11:40:35 -08:00
test_otel_v2_vendor_mappers.py feat(otel): add Mixpanel OpenTelemetry v2 preset callback (#49999) 2026-11-25 10:27:02 -08:00
test_runtime.py feat(otel): trace auto-router configuration and classifier failures (#44926) 2026-10-06 15:40:34 -07:00