diff --git a/tests/test_litellm/containers/test_azure_container_transformation.py b/tests/test_litellm/containers/test_azure_container_transformation.py index 1c990220e11..2b051a26d16 100644 --- a/tests/test_litellm/containers/test_azure_container_transformation.py +++ b/tests/test_litellm/containers/test_azure_container_transformation.py @@ -947,9 +947,8 @@ class TestAzureContainerKnownFailureRegressions: file_purpose=ownership.CONTAINER_OBJECT_PURPOSE, unified_object_id=encoded_stored_id, ) - prisma_client = SimpleNamespace( - db=SimpleNamespace(litellm_managedobjecttable=table) - ) + tables = SimpleNamespace(litellm_managedobjecttable=table) + prisma_client = SimpleNamespace(db=tables, replica_db=tables) monkeypatch.setattr( ownership, "_get_prisma_client", diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py index cd5dae1269a..6bf17d9cbf9 100644 --- a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py +++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py @@ -1094,7 +1094,8 @@ class TestMCPServerManager: table = SimpleNamespace( find_many=AsyncMock(return_value=[_row(cached.server_id, corrupted), _row("healthy-sibling", stored)]) ) - prisma = SimpleNamespace(db=SimpleNamespace(litellm_mcpservertable=table)) + tables = SimpleNamespace(litellm_mcpservertable=table) + prisma = SimpleNamespace(db=tables, replica_db=tables) monkeypatch.setattr(proxy_server, "prisma_client", prisma) with caplog.at_level(logging.DEBUG, logger="LiteLLM"): diff --git a/tests/test_litellm/proxy/container_endpoints/test_endpoints.py b/tests/test_litellm/proxy/container_endpoints/test_endpoints.py index 1beff4c82ba..644230dbd19 100644 --- a/tests/test_litellm/proxy/container_endpoints/test_endpoints.py +++ b/tests/test_litellm/proxy/container_endpoints/test_endpoints.py @@ -106,10 +106,11 @@ def test_list_containers_pages_upstream_until_non_admin_keys_see_their_container monkeypatch.setitem(sys.modules, "litellm.proxy.proxy_server", PROXY_SERVER_STUB) table = AsyncMock() table.find_many.return_value = [SimpleNamespace(model_object_id="container:openai:cntr_owned")] + tables = SimpleNamespace(litellm_managedobjecttable=table) monkeypatch.setattr( ownership, "_get_prisma_client", - AsyncMock(return_value=SimpleNamespace(db=SimpleNamespace(litellm_managedobjecttable=table))), + AsyncMock(return_value=SimpleNamespace(db=tables, replica_db=tables)), ) processor_cls = _upstream_pages( monkeypatch, diff --git a/tests/test_litellm/proxy/management_endpoints/test_prompt_caching_requests.py b/tests/test_litellm/proxy/management_endpoints/test_prompt_caching_requests.py index 0995de6c39d..98b38da1e47 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_prompt_caching_requests.py +++ b/tests/test_litellm/proxy/management_endpoints/test_prompt_caching_requests.py @@ -169,7 +169,7 @@ async def test_request_filters_match_accounting_and_paginate_before_projection( from litellm.proxy import proxy_server _seed(_cache_postgresql) - monkeypatch.setattr(proxy_server, "prisma_client", SimpleNamespace(db=_cache_prisma)) + monkeypatch.setattr(proxy_server, "prisma_client", SimpleNamespace(db=_cache_prisma, replica_db=_cache_prisma)) monkeypatch.setattr(proxy_server, "llm_router", None) expected: Final = tuple(sorted((case.request_id for case in _CASES if case.matches(filter)), reverse=True)) async with httpx.AsyncClient(transport=httpx.ASGITransport(app=_app(role)), base_url="http://test") as client: @@ -285,7 +285,7 @@ async def test_cursor_keeps_remaining_requests_once_during_insertions_and_deleti "older-cache-read", {"usage_object": {"cache_read_input_tokens": 100}}, start_time=datetime(2026, 9, 1, 11), )) _seed(_cache_postgresql, cases) - monkeypatch.setattr(proxy_server, "prisma_client", SimpleNamespace(db=_cache_prisma)) + monkeypatch.setattr(proxy_server, "prisma_client", SimpleNamespace(db=_cache_prisma, replica_db=_cache_prisma)) monkeypatch.setattr(proxy_server, "llm_router", None) expected: Final = (*sorted((case.request_id for case in _CASES if case.matches("all")), reverse=True), "older-cache-read") async with httpx.AsyncClient( diff --git a/tests/test_litellm/proxy/management_helpers/test_auto_router_permissions.py b/tests/test_litellm/proxy/management_helpers/test_auto_router_permissions.py index e16271a5189..f305b2e3ef4 100644 --- a/tests/test_litellm/proxy/management_helpers/test_auto_router_permissions.py +++ b/tests/test_litellm/proxy/management_helpers/test_auto_router_permissions.py @@ -40,6 +40,7 @@ class _PermissionDb: @dataclass(frozen=True) class _Client: db: _PermissionDb = _PermissionDb() + replica_db: _PermissionDb = db def _team(**updates: object) -> LiteLLM_TeamTable: diff --git a/tests/test_litellm/proxy/management_helpers/test_resource_display_names.py b/tests/test_litellm/proxy/management_helpers/test_resource_display_names.py index b530bc15c25..6df5958061e 100644 --- a/tests/test_litellm/proxy/management_helpers/test_resource_display_names.py +++ b/tests/test_litellm/proxy/management_helpers/test_resource_display_names.py @@ -19,7 +19,8 @@ def _table(rows=()): def _prisma(**tables): - return types.SimpleNamespace(db=types.SimpleNamespace(**tables)) + db = types.SimpleNamespace(**tables) + return types.SimpleNamespace(db=db, replica_db=db) def _config_server(server_id: str, name: str, alias: str | None = None, server_name: str | None = None) -> MCPServer: diff --git a/tests/test_litellm/proxy/policy_engine/test_attachment_registry.py b/tests/test_litellm/proxy/policy_engine/test_attachment_registry.py index faa8d67fe3a..ac87b44ba42 100644 --- a/tests/test_litellm/proxy/policy_engine/test_attachment_registry.py +++ b/tests/test_litellm/proxy/policy_engine/test_attachment_registry.py @@ -653,6 +653,7 @@ def _make_db_attachment_row( def _prisma_with_attachment_rows(rows: list[MagicMock]) -> MagicMock: prisma = MagicMock() prisma.configure_mock(**{"db.litellm_policyattachmenttable.find_many": AsyncMock(return_value=rows)}) + prisma.replica_db = prisma.db return prisma diff --git a/tests/test_litellm/proxy/test_proxy_utils.py b/tests/test_litellm/proxy/test_proxy_utils.py index 1005e423a28..0a4b4c1a763 100644 --- a/tests/test_litellm/proxy/test_proxy_utils.py +++ b/tests/test_litellm/proxy/test_proxy_utils.py @@ -1785,6 +1785,7 @@ async def test_update_data_key_branch_stamps_settings_updated_at(): client = MagicMock() client.jsonify_object = MagicMock(side_effect=lambda data: dict(data)) client.db.litellm_verificationtoken.update = AsyncMock(return_value=None) + client.replica_db = client.db before = datetime.now(timezone.utc) await PrismaClient.update_data(client, token="sk-test-key", data={"models": ["gpt-4"]})