litellm/tests
yuneng-jiang e44b5ecadd
fix(auth): apply current team limits in the pre-body rate limit check (#52169)
* fix(auth): apply current team limits in the pre-body rate limit check

The check that refuses an exhausted key before reading the request body
used the team limits copied onto the cached key. Raising a team's rpm or
tpm limit with /team/update did not reach that copy, so a throttled key
stayed throttled until the key cache expired, and the full auth path that
does refresh team fields never ran.

The check now overlays the cached team's newer fields the same way full
auth does, through one shared helper. When the team is not in the cache,
as on a peer right after an invalidation, it defers to full auth instead
of judging the key on stale limits.

* fix(auth): keep key limits in the early check when the team is not cached

On a team cache miss the early check skipped every pre-body limit, so an
exhausted key read its body before being refused. Apply the key's own
limits and defer to full auth only when the cached team limit refuses.

Adapted for rc/1.110.0: the test file imports MappingProxyType, which main's copy
already had from an earlier commit. The test reads which limit refused the request
from the 429 message, since the rate_limited_by header comes from #51228, which this
line does not have.

(cherry picked from commit 7f7bb13707)
2026-11-17 13:34:40 -08:00
..
_support feat(mcp): add an opt-in per-server setting to skip MCP tool output validation (#49961) 2026-11-03 20:42:10 -08:00
audio_tests feat(vertex-ai)!: support gemini 3.1 flash tts (#31915) 2026-10-21 04:18:42 +00:00
base_sdk_tests feat(packaging): build litellm-proxy gateway wheels (#49605) 2026-11-05 16:37:12 -08:00
benchmarks fix(realtime)!: send the Gemini Live setup at the first content so session.update settings apply (#39864) 2026-10-30 01:31:39 -07:00
code_coverage_tests fix(token-counter): count Anthropic server tool history (#51334) 2026-11-14 11:19:13 -08:00
documentation_tests
e2e fix(ui): preserve credential actions across dashboard renders (#50845) 2026-11-16 15:25:32 -08:00
e2e_harness test(e2e): add a Codex row where a sub-agent must read the task its parent hands it (#50494) 2026-11-07 21:16:39 +00:00
fixtures
harness_e2e
integration fix(gemini): attribute /gemini batchGenerateContent batches to the calling key (#51279) 2026-11-17 05:32:58 +00:00
rust-python-harness fix(messages): make rust messages copy python messages behaviour (#49611) 2026-11-02 21:02:52 -08:00
test_litellm_rust feat(redis): serve the proxy's common Redis call with Rust stores (#50170) 2026-11-06 06:01:11 +00:00
typing
unit fix(auth): apply current team limits in the pre-body rate limit check (#52169) 2026-11-17 13:34:40 -08:00
windows_tests refactor(rust-bridge): require the native extension (#48852) 2026-10-28 13:16:56 -07:00
__init__.py
_fake_openai_endpoint_server.py
_flush_vcr_cache.py
_live_test_helpers.py
_master_key.py
_openai_record_replay_proxy.py
_process_helpers.py
_vcr_conftest_common.py
_vcr_redis_persister.py
_wait_helpers.py
_ws_vcr.py
AGENTS.md
capturing_transport.py
eval_swe_bench.py
fake_openai_endpoint.py
gettysburg.wav
large_text.py
openai_batch_completions.jsonl
pyrightconfig.json
README.MD
test_logging.conf
test_rust_python_harness.py
VCR_TESTING.md
white_100x100.png

In total litellm runs 1000+ tests

[02/20/2025] Update:

To make it easier to contribute and map what behavior is tested,

we've started mapping the litellm directory in tests/unit

This folder can only run mock tests.