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]

test fix

Ishaan Jaffer53503828b2f5
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 0cedeb71686..d1440cf7a1b 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -616,6 +616,24 @@ jobs:
wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz
sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz
rm dockerize-linux-amd64-v0.6.1.tar.gz
+ - run:
+ name: Start PostgreSQL Database
+ command: |
+ docker run -d \
+ --name postgres-db \
+ -e POSTGRES_USER=postgres \
+ -e POSTGRES_PASSWORD=postgres \
+ -e POSTGRES_DB=circle_test \
+ -p 5432:5432 \
+ postgres:14
+ - run:
+ name: Wait for PostgreSQL to be ready
+ command: dockerize -wait tcp://localhost:5432 -timeout 1m
+ - run:
+ name: Set DATABASE_URL environment variable
+ command: |
+ echo 'export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/circle_test"' >> $BASH_ENV
+ source $BASH_ENV
- run:
name: Run Security Scans
command: |
diff --git a/tests/proxy_security_tests/test_master_key_not_in_db.py b/tests/proxy_security_tests/test_master_key_not_in_db.py
index e563b735a21..80758ce0a55 100644
--- a/tests/proxy_security_tests/test_master_key_not_in_db.py
+++ b/tests/proxy_security_tests/test_master_key_not_in_db.py
@@ -4,13 +4,13 @@ from fastapi.testclient import TestClient
from litellm.proxy.proxy_server import app, ProxyLogging
from litellm.caching import DualCache
-TEST_DB_ENV_VAR_NAME = "MASTER_KEY_CHECK_DB_URL"
-
@pytest.fixture(autouse=True)
def override_env_settings(monkeypatch):
# Set environment variables only for tests using-monkeypatch (function scope by default).
- monkeypatch.setenv("DATABASE_URL", os.environ[TEST_DB_ENV_VAR_NAME])
+ # Use DATABASE_URL from environment (set by CircleCI to local postgres)
+ if "DATABASE_URL" not in os.environ:
+ pytest.fail("DATABASE_URL not set - this test requires a local postgres database to be running")
monkeypatch.setenv("LITELLM_MASTER_KEY", "sk-1234")
monkeypatch.setenv("LITELLM_LOG", "DEBUG")
@@ -38,7 +38,7 @@ async def test_master_key_not_inserted(test_client):
from litellm.proxy.utils import PrismaClient
prisma_client = PrismaClient(
- database_url=os.environ[TEST_DB_ENV_VAR_NAME],
+ database_url=os.environ["DATABASE_URL"],
proxy_logging_obj=ProxyLogging(
user_api_key_cache=DualCache(), premium_user=True
),