Litellm fix db testing (#9593)

* ci: fix test

* test: safely change db url

* fix: print db url

* test: remove delenv
This commit is contained in:
Krish Dholakia 2025-03-27 14:50:41 -07:00 committed by GitHub
parent f1f40eba3f
commit 11838e1c3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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"

View File

@ -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.flaky(reruns=3)
@pytest.mark.parametrize("entity_type", ["key", "user", "team"])
async def test_reset_budget_job(prisma_client, entity_type):
"""