Skip to content

test(auth): freeze the cache clock in auth prefetch tests - #41204

Closed
cursor[bot] wants to merge 6 commits into
mainfrom
cursor/ci-autofix-automation-56f8
Closed

cursor[bot] wants to merge 6 commits into
mainfrom
cursor/ci-autofix-automation-56f8

Conversation

@cursor

@cursor cursor Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Postgres Tests fail on litellm_internal_staging with a MagicMock await TypeError
  • The auth prefetch org cache entries expire mid-test on slow CI runners

How it solves it:

User Flow

Not user-facing, test-only

Relevant issues

Same flake as #40996 (already merged to main)

Type

✅ Test

Screenshots / Proof of Fix

Before (af6dc1d)

  1. Run pytest tests/proxy_behavior/auth/test_auth_object_prefetch.py::test_join_binds_the_membership_to_the_requested_team on a cold runner
  2. Test fails with TypeError: object MagicMock can't be used in 'await' expression because the org cache entry has expired by the time get_org_object reads it, falling through to the MagicMock DB. See failing run: https://github.com/BerriAI/litellm/actions/runs/34906640889/job/98462116938

After (b18e38d)

  1. Run pytest tests/proxy_behavior/auth/test_auth_object_prefetch.py -vv
  2. Output:
tests/proxy_behavior/auth/test_auth_object_prefetch.py::test_join_binds_the_membership_to_the_requested_team PASSED [ 33%]
tests/proxy_behavior/auth/test_auth_object_prefetch.py::test_join_reads_team_model_aliases_from_the_mapped_column PASSED [ 66%]
tests/proxy_behavior/auth/test_auth_object_prefetch.py::test_join_reads_null_nested_lists_the_way_prisma_does PASSED [100%]

============================== 3 passed in 4.22s ===============================
Open in Web View Automation 

milan-berri and others added 6 commits August 21, 2026 02:41
…nd Model Hub UI

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…mutation

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ow read fails

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
feat(model_hub): surface model_info.description in Model Hub
…_on_failed_read

fix(health): skip background health check DB writes when the latest-row read fails
The org cache entries written by prefetch_auth_objects carry the 5s
DEFAULT_IN_MEMORY_TTL. The first @log_db_metrics getter lazily imports
litellm.proxy.proxy_server, which on a cold CI runner can take longer
than 5s, so the org entry expired before get_org_object read it and the
getter fell through to the MagicMock database. Inject a frozen clock
into InMemoryCache so the test asserts the join, not import latency.

Cherry-pick of db79226, already landed on main via #40876 but not
yet on litellm_internal_staging.

Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@devin-ai-integration
devin-ai-integration Bot changed the base branch from litellm_internal_staging to main September 23, 2026 14:34
@CLAassistant

CLAassistant commented Oct 24, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 4 committers have signed the CLA.

✅ milan-berri
✅ ryan-crabbe-berri
❌ yassin-berriai
❌ cursoragent
You have signed the CLA already but the status is still pending? Let us recheck it.

@mateo-berri

Copy link
Copy Markdown
Contributor

Main already has the frozen cache clock for the prefetch tests from #40996, and the other commits here merged already. Reopen if something is missing

@mateo-berri mateo-berri closed this Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants