From 36d4afd59ab9ab75b8a38a0bf60b415f034a6181 Mon Sep 17 00:00:00 2001 From: Maximilian Rink Date: Sat, 10 Oct 2026 04:08:20 +0200 Subject: [PATCH] test: assert caller cache hit before isolation miss --- .../proxy/proxy_server/test_db_router_response_cache.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/unit/proxy/proxy_server/test_db_router_response_cache.py b/tests/unit/proxy/proxy_server/test_db_router_response_cache.py index edabb447266..fc1566a38fc 100644 --- a/tests/unit/proxy/proxy_server/test_db_router_response_cache.py +++ b/tests/unit/proxy/proxy_server/test_db_router_response_cache.py @@ -80,10 +80,14 @@ async def test_db_router_rebuild_serves_same_caller_from_cache_and_isolates_call first = await router.acompletion(model="fake-model", messages=request, user=same_caller_id) await asyncio.wait_for(cache_write_complete.wait(), timeout=5) same_caller = await router.acompletion(model="fake-model", messages=request, user=same_caller_id) + # The identical body and caller must be served from the cached response. + assert same_caller.id == first.id + assert provider_calls == 1 + other_caller = await router.acompletion(model="fake-model", messages=request, user=other_caller_id) - assert first.id == same_caller.id - assert first.id != other_caller.id + # Changing only the authenticated caller must miss the cache. + assert other_caller.id != first.id assert provider_calls == 2