litellm/tests/proxy_behavior/auth
Cursor Agent 7fd2c3bb8a
test(auth): isolate prefetch assertions from cache expiry
The three Postgres prefetch tests warm the cache, then run a series of
per-object getters against a MagicMock stand-in for the DB, asserting
'getters must be served from the prefetched cache'. When the test's
real-time DB writes and prefetch round-trip exceed DEFAULT_IN_MEMORY_TTL
(5s), the org cache entry expires and get_org_object falls through to
the MagicMock, producing 'TypeError: object MagicMock can't be used in
await expression' at the assertion point.

Freeze the in-memory cache clock with clock=lambda: 0.0 so entries never
tick past their TTL during the test. The behaviour under test (join +
prefetch + cache serve) is unaffected.

Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
2026-09-13 21:20:17 +00:00
..
__init__.py perf(auth): read user, team, membership, org, project and spend counters in one MGET, one query and one pipeline (#40834) 2026-09-12 08:52:23 -07:00
conftest.py perf(auth): read user, team, membership, org, project and spend counters in one MGET, one query and one pipeline (#40834) 2026-09-12 08:52:23 -07:00
test_auth_object_prefetch.py test(auth): isolate prefetch assertions from cache expiry 2026-09-13 21:20:17 +00:00