test(caching): drive the redis stall burst off the clock, not asyncio.wait_for - #39773
Merged
yuneng-berri merged 1 commit intoSep 4, 2026
Merged
Conversation
….wait_for test_event_loop_stall_timeout_burst_keeps_breaker_closed built its timeout burst by wrapping a healthy fake call in asyncio.wait_for. Before 3.12, wait_for returns the inner result when the inner future also completed while the loop was blocked, so no call timed out, the burst never materialised, and the test's own liveness guard failed with 0 >= 3. The fake now checks its own client deadline against the clock, the way a client library does, so the stall produces a real redis TimeoutError burst on every interpreter. The breaker itself is unchanged: its duration gate is plain time.time() bookkeeping and never depended on the version.
Contributor
Greptile SummaryThis PR makes the Redis circuit-breaker stall test consistent across supported Python versions
Confidence Score: 5/5The test-only change appears safe to merge The revised fake deterministically produces the intended timeout burst, follows the same breaker classification path, and retains the existing behavioral assertions
|
| Filename | Overview |
|---|---|
| tests/test_litellm/caching/test_redis_cache.py | Updates the timeout fake without weakening the breaker duration-gate regression coverage |
Reviews (1): Last reviewed commit: "test(caching): drive the redis stall bur..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
tin-berri
approved these changes
Sep 4, 2026
yuneng-berri
merged commit Sep 4, 2026
4ad4db2
into
litellm_internal_staging
180 of 181 checks passed
This was referenced Sep 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
How it solves it:
User Flow
This PR changes no product code, so the person it affects is a contributor watching CI on their PR
Before: any PR touching the caching shard goes red on two matrix legs for a reason that has nothing to do with it
responses-caching-types / Run tests (Python 3.10)and(Python 3.11)failtest_event_loop_stall_timeout_burst_keeps_breaker_closed, withassert 0 >= 3After: the shard is green on all five legs, so a red leg means the contributor's own change
responses-caching-types / Run testspasses on 3.10, 3.11, 3.12, 3.13 and 3.14Relevant issues
Linear ticket
Pre-Submission checklist
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
This PR edits one test function and no product code, so there is no request to send at a proxy and nothing an end user can observe. The proof is the same test file across the five interpreters CI runs, before and after
Setup, run from the repo root once per version:
Before (f74bc94)
tests/test_litellm/caching/test_redis_cache.py across the CI matrix
for V in 3.10 3.11 3.12 3.13 3.14; do uv run -p $V pytest tests/test_litellm/caching/test_redis_cache.py -q -k event_loop_stall; doneAfter (7d3b03d)
tests/test_litellm/caching/test_redis_cache.py across the CI matrix
for V in 3.10 3.11 3.12 3.13 3.14; do uv run -p $V pytest tests/test_litellm/caching/test_redis_cache.py -q; doneType
✅ Test
Caveats (if any)
Low
Final Attestation