mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-13 08:52:02 +00:00
test(proxy): model Prisma client cleanup
This commit is contained in:
parent
8101b24fad
commit
3d6ad6db4d
1 changed files with 20 additions and 0 deletions
|
|
@ -1656,6 +1656,12 @@ class MockPrisma:
|
|||
async def stop_background_tasks(self):
|
||||
pass
|
||||
|
||||
async def aclose(self):
|
||||
try:
|
||||
await self.stop_background_tasks()
|
||||
finally:
|
||||
await self.disconnect()
|
||||
|
||||
|
||||
mock_prisma = MockPrisma()
|
||||
|
||||
|
|
@ -1855,6 +1861,12 @@ class _PrismaClientWhoseDatabaseRejectsQueries:
|
|||
async def stop_background_tasks(self) -> None:
|
||||
pass
|
||||
|
||||
async def aclose(self) -> None:
|
||||
try:
|
||||
await self.stop_background_tasks()
|
||||
finally:
|
||||
await self.disconnect()
|
||||
|
||||
class _Database:
|
||||
async def query_raw(self, query, *args):
|
||||
raise RuntimeError("permission denied for table LiteLLM_CredentialsTable")
|
||||
|
|
@ -14032,6 +14044,14 @@ def _mock_startup_prisma_client(health_check_error=None, connect_error=None):
|
|||
client.start_view_setup_task = MagicMock()
|
||||
client.start_db_health_watchdog_task = AsyncMock()
|
||||
client.health_check = AsyncMock(side_effect=health_check_error)
|
||||
|
||||
async def close_client() -> None:
|
||||
try:
|
||||
await client.stop_background_tasks()
|
||||
finally:
|
||||
await client.disconnect()
|
||||
|
||||
client.aclose = AsyncMock(side_effect=close_client)
|
||||
return client
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue