Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Litellm fix db testing (#9593)

Krish Dholakia11838e1c3bd9
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 91636c5625c..e1488a9083b 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -500,6 +500,12 @@ jobs:
working_directory: ~/project
steps:
- checkout
+ - run:
+ name: Install PostgreSQL
+ command: |
+ sudo apt-get update
+ sudo apt-get install postgresql postgresql-contrib
+ echo 'export PATH=/usr/lib/postgresql/*/bin:$PATH' >> $BASH_ENV
- setup_google_dns
- run:
name: Show git commit hash
diff --git a/tests/proxy_unit_tests/test_db_schema_migration.py b/tests/proxy_unit_tests/test_db_schema_migration.py
index 59367aa9cb3..47125e86a72 100644
--- a/tests/proxy_unit_tests/test_db_schema_migration.py
+++ b/tests/proxy_unit_tests/test_db_schema_migration.py
@@ -17,12 +17,12 @@ def schema_setup(postgresql_my):
return postgresql_my
-def test_schema_migration_check(schema_setup):
+def test_aaaasschema_migration_check(schema_setup, monkeypatch):
"""Test to check if schema requires migration"""
# Set test database URL
test_db_url = f"postgresql://{schema_setup.info.user}:@{schema_setup.info.host}:{schema_setup.info.port}/{schema_setup.info.dbname}"
# test_db_url = "postgresql://neondb_owner:npg_JiZPS0DAhRn4@ep-delicate-wave-a55cvbuc.us-east-2.aws.neon.tech/neondb?sslmode=require"
- os.environ["DATABASE_URL"] = test_db_url
+ monkeypatch.setenv("DATABASE_URL", test_db_url)
deploy_dir = Path("./deploy")
source_migrations_dir = deploy_dir / "migrations"
diff --git a/tests/proxy_unit_tests/test_key_generate_prisma.py b/tests/proxy_unit_tests/test_key_generate_prisma.py
index f922b2c27f2..bbfa5b1c117 100644
--- a/tests/proxy_unit_tests/test_key_generate_prisma.py
+++ b/tests/proxy_unit_tests/test_key_generate_prisma.py
@@ -3286,6 +3286,7 @@ async def test_aadmin_only_routes(prisma_client):
only an admin should be able to access admin only routes
"""
litellm.set_verbose = True
+ print(f"os.getenv('DATABASE_URL')={os.getenv('DATABASE_URL')}")
setattr(litellm.proxy.proxy_server, "prisma_client", prisma_client)
setattr(litellm.proxy.proxy_server, "master_key", "sk-1234")
await litellm.proxy.proxy_server.prisma_client.connect()
@@ -3882,6 +3883,7 @@ async def test_get_paginated_teams(prisma_client):
@pytest.mark.asyncio
@pytest.mark.parametrize("entity_type", ["key", "user", "team"])
async def test_reset_budget_job(prisma_client, entity_type):
"""