litellm/tests/unit/proxy/db
paveln83 b4918c9a05
fix(proxy): start and serve the proxy with a database on Python 3.10 and prisma 0.13+ (#54416)
* fix(proxy): start the Prisma engine on Python 3.10 and pin prisma to the versions it supports

The port-owning query engine waited with asyncio.timeout, which only exists on Python 3.11+, so a proxy with a database could not start on 3.10. It now waits with asyncio.wait_for

The engine subclass imports prisma.builder, which prisma 0.13 removed, so extra_proxy now allows prisma>=0.11.0,<0.13. prisma 0.12.0 passes the engine tests on 3.10

A fake query engine executable covers the connect, silent, and early-exit paths, and a new prisma-engine-python-310 CI shard runs those tests on Python 3.10 whenever the engine code changes

* fix(proxy): run the Prisma engine on prisma 0.13+ and fix Python 3.10 chat with a database

Drop the prisma<0.13 cap and make the engine subclass work on prisma 0.11 through 0.15. OVERWRITE_DATASOURCES is built with json.dumps instead of the removed prisma.builder, and the client's HTTP options reach the engine as http_config when its constructor takes it

Build CallContext without the subscripted alias, which raised TypeError on Python 3.10 for every chat call with a database

Move the engine tests that start a real process to tests/integration/database, and have the Python 3.10 CI shard install prisma 0.15.0 and run the dispatcher tests too

* fix(proxy): set the Prisma client engine through its setter so prisma 0.15 connects

* test(proxy): run the query engine spawn path in-process on Python 3.10

* fix(proxy): keep TimeoutError as the cause of the query engine connect timeout

The connect timeout EngineConnectionError chains the TimeoutError again, as on the merge base, so the startup traceback keeps its direct cause block

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-26 00:09:17 +00:00
..
db_transaction_queue fix(proxy): avoid blocking writes when attaching spend log partitions (#53858) 2026-11-23 11:19:33 -08:00
mcp_server refactor(mcp): drop the experimental label from the MCP server and client paths (#48513) 2026-10-27 17:47:50 +00:00
__init__.py
conftest.py
fake_prisma_engine.py fix(proxy): cancel the Admin UI's raw spend-log reads in Postgres after 30s (#49965) 2026-11-03 16:07:00 -08:00
test_autorouter_session_rollup.py fix(proxy): retain unwritten rollups after database disconnects (#51706) 2026-11-13 13:36:12 -08:00
test_budget_window_spend_writer.py fix(proxy): preserve budget window edits during resets (#53064) 2026-11-20 10:50:27 -08:00
test_check_migration.py fix(proxy): point the startup schema drift check at the packaged schema.prisma (#52435) 2026-11-19 17:49:06 -08:00
test_connection_budget.py feat(spend-logs): rust spend log callback (#52182) 2026-11-20 16:31:04 -08:00
test_create_views.py
test_daily_spend_bulk_upsert.py feat(proxy): add app groups with shared budgets and usage (#53232) 2026-11-21 12:50:58 -08:00
test_db_lookup_gate.py test: make three flaky unit tests deterministic (#50114) 2026-11-04 14:38:44 -08:00
test_db_span.py
test_db_spend_update_writer.py fix(proxy): stop requeueing rejected tool discovery batches to Redis (#53886) 2026-11-23 11:57:09 -08:00
test_db_url_settings.py feat(db): add an optional native reader pool with explicit routing (#49804) 2026-11-14 15:28:10 -08:00
test_exception_handler.py fix(proxy): retain unwritten rollups after database disconnects (#51706) 2026-11-13 13:36:12 -08:00
test_exception_handler_reconnect_retry.py
test_gateway_request_tracking.py
test_health_check_latest.py
test_log_db_metrics.py
test_log_db_metrics_service_spans.py test: deflake proxy metrics and shutdown drain (#51078) 2026-11-10 21:05:41 -08:00
test_master_key_migration.py fix(proxy): rotate all database secrets with the master key (#52998) 2026-11-20 10:02:59 -08:00
test_model_access_group_spend.py feat(proxy): enforce customer org, team and member budgets and limits on the request path (#51489) 2026-11-12 20:43:44 -08:00
test_model_insights_tasks.py
test_model_usage_rollup.py feat(alerts): detect daily changes in recorded usage (#50666) 2026-11-11 18:23:02 -08:00
test_native_database.py feat(auth): read virtual keys, jwt key mappings and model access groups through rust repositories (#52173) 2026-11-18 03:53:37 +00:00
test_object_permission_repository.py
test_pgbouncer.py test(unit): keep unix socket paths in unit tests under the macOS AF_UNIX limit (#45040) 2026-10-28 20:23:22 -07:00
test_prisma_client.py feat(proxy): replace the pre-migration row check with a rolled-back dry run of the pending migrations (#48961) 2026-10-29 09:39:26 -07:00
test_prisma_engine.py fix(proxy): start and serve the proxy with a database on Python 3.10 and prisma 0.13+ (#54416) 2026-11-26 00:09:17 +00:00
test_prisma_planned_engine_restart.py fix(proxy): start and serve the proxy with a database on Python 3.10 and prisma 0.13+ (#54416) 2026-11-26 00:09:17 +00:00
test_prisma_query_span.py chore: move scripts and runtime sources under litellm (#51006) 2026-11-12 04:19:57 +00:00
test_prisma_self_heal.py fix(proxy): recover from a read replica reconnect that times out (#52592) 2026-11-18 12:03:24 -08:00
test_proxy_worker_heartbeat.py
test_query_engine_reaper.py
test_rds_iam_token_expiry.py
test_replica_identity.py
test_request_error_tracking.py
test_routing_prisma_wrapper.py fix(proxy): recover from a read replica reconnect that times out (#52592) 2026-11-18 12:03:24 -08:00
test_rust_spend_log_writer.py feat(spend-logs): rust spend log ledger writer (#52163) 2026-11-20 16:31:04 -08:00
test_scheduled_job_runs.py feat(proxy): run spend log cleanup from a DB-backed scheduled job table (#50131) 2026-11-11 18:22:02 -08:00
test_shadow_eval_funnel.py feat(shadow-eval): skip redundant reverse evaluations on opt-in (#52192) 2026-11-16 21:38:00 -08:00
test_spend_counter_reseed.py feat(proxy): support budget_limits windows on internal users (#51763) 2026-11-14 07:44:35 -05:00
test_spend_log_batching.py
test_spend_log_tool_index.py fix(proxy): stop requeueing rejected tool discovery batches to Redis (#53886) 2026-11-23 11:57:09 -08:00
test_token_auth.py
test_tool_registry_writer.py fix(proxy): stop requeueing rejected tool discovery batches to Redis (#53886) 2026-11-23 11:57:09 -08:00
test_tool_table_bulk_upsert.py fix(proxy): buffer tool discoveries in Redis and write LiteLLM_ToolTable in one statement per drain, on its own lock (#48089) 2026-10-24 12:34:13 -07:00
test_update_daily_tag_spend.py