litellm/tests/unit/proxy/db
yujonglee 1bc3190a94
feat(db): classify errors and recycle poisoned pools like Prisma (#49801)
db::Error now reports a kind that matches PrismaDBExceptionHandler's buckets:
unreachable, capacity, deadlock, serialization failure, lock timeout, read-only
after failover, stale cached plan and rejected data. is_unavailable gates
fail-open and is_requeue_safe says whether a failed write provably never
applied

Pools::recycle_after is the native counterpart of recreating the Prisma
client: after a 25006 (the writer endpoint now points at a read-only node) or
"cached plan must not change result type" (a migration changed a table under
a prepared statement), every pooled connection opened before the error is
dropped on its next acquire, so the pool reconnects and prepares fresh

Native failures reached Python as a ValueError, so allow_requests_on_db_unavailable
treated a native outage as a permanent fault and a write on a dropped connection
was requeued. The bridge now raises NativeDatabaseFailure with the kind and the
Rust answers for is_unavailable and is_requeue_safe, and the two Python gates
return them
2026-11-14 15:28:11 -08:00
..
db_transaction_queue
mcp_server
__init__.py
conftest.py
fake_prisma_engine.py
test_autorouter_session_rollup.py
test_budget_window_spend_writer.py
test_check_migration.py
test_connection_budget.py
test_create_views.py
test_daily_spend_bulk_upsert.py
test_db_lookup_gate.py
test_db_span.py
test_db_spend_update_writer.py
test_db_url_settings.py
test_exception_handler.py
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_master_key_migration.py
test_model_access_group_spend.py
test_model_insights_tasks.py
test_model_usage_rollup.py
test_native_database.py
test_object_permission_repository.py
test_pgbouncer.py
test_prisma_client.py
test_prisma_engine.py
test_prisma_planned_engine_restart.py
test_prisma_query_span.py
test_prisma_self_heal.py
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
test_scheduled_job_runs.py
test_shadow_eval_funnel.py
test_spend_counter_reseed.py
test_spend_log_batching.py
test_spend_log_tool_index.py
test_token_auth.py
test_tool_registry_writer.py
test_tool_table_bulk_upsert.py
test_update_daily_tag_spend.py