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]

[Infra] Optimize CI: migrate litellm_security_tests from machine to docker xlarge

yuneng-jiangf68a9be04d99
diff --git a/.circleci/config.yml b/.circleci/config.yml
index d697a9d61ee..c9feb5c4aca 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -666,10 +666,20 @@ jobs:
- store_test_results:
path: test-results
litellm_security_tests:
- machine:
- image: ubuntu-2204:2023.10.1
- resource_class: medium
+ docker:
+ - image: cimg/python:3.13
+ auth:
+ username: ${DOCKERHUB_USERNAME}
+ password: ${DOCKERHUB_PASSWORD}
+ - image: cimg/postgres:14.0
+ environment:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: postgres
+ POSTGRES_DB: circle_test
+ resource_class: xlarge
working_directory: ~/project
+ environment:
+ DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/circle_test"
steps:
- checkout
- setup_google_dns
@@ -677,87 +687,33 @@ jobs:
name: Show git commit hash
command: |
echo "Git commit hash: $CIRCLE_SHA1"
- - run:
- name: Install Docker CLI (In case it's not already installed)
- command: |
- curl -fsSL https://get.docker.com | sh
- sudo usermod -aG docker $USER
- docker version
- - run:
- name: Install Python 3.13
- command: |
- curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh --output miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- conda init bash
- source ~/.bashrc
- conda create -n myenv python=3.13 -y
- conda activate myenv
- python --version
+ - setup_remote_docker:
+ docker_layer_caching: true
+ - restore_cache:
+ keys:
+ - v3-litellm-uv-deps-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }}
- run:
name: Install Dependencies
command: |
- export PATH="$HOME/miniconda/bin:$PATH"
- source $HOME/miniconda/etc/profile.d/conda.sh
- conda activate myenv
- python --version
- which python
- pip install --upgrade typing-extensions>=4.12.0
- pip install "pytest==7.3.1"
- pip install "pytest-asyncio==0.21.1"
- pip install aiohttp
- python -m pip install --upgrade pip
- python -m pip install -r requirements.txt
- pip install "pytest==7.3.1"
- pip install "pytest-retry==1.6.3"
- pip install "pytest-mock==3.12.0"
- pip install "pytest-asyncio==0.21.1"
- pip install "mypy==1.18.2"
- pip install "google-generativeai==0.3.2"
- pip install "google-cloud-aiplatform==1.43.0"
- pip install pyarrow
- pip install "boto3==1.36.0"
- pip install "aioboto3==13.4.0"
- pip install langchain
- pip install "langfuse>=2.0.0"
- pip install "logfire==0.29.0"
- pip install numpydoc
- pip install prisma
- pip install fastapi
- pip install jsonschema
- pip install "httpx==0.24.1"
- pip install "gunicorn==21.2.0"
- pip install "anyio==3.7.1"
- pip install "aiodynamo==23.10.1"
- pip install "asyncio==3.4.3"
- pip install "PyGithub==1.59.1"
- pip install "openai==1.100.1"
- pip install "pytest-cov==5.0.0"
- pip install "apscheduler"
+ python -m pip install --upgrade pip uv
+ uv pip install --system -r requirements.txt
+ pip install "pytest==7.3.1" "pytest-retry==1.6.3" "pytest-mock==3.12.0" \
+ "pytest-asyncio==0.21.1" "pytest-cov==5.0.0"
+ - save_cache:
+ paths:
+ - ~/.local/lib
+ - ~/.local/bin
+ - ~/.cache/uv
+ key: v3-litellm-uv-deps-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }}
- run:
name: Install dockerize
command: |
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: |
@@ -766,9 +722,6 @@ jobs:
- run:
name: Run prisma ./docker/entrypoint.sh
command: |
- export PATH="$HOME/miniconda/bin:$PATH"
- source $HOME/miniconda/etc/profile.d/conda.sh
- conda activate myenv
set +e
chmod +x docker/entrypoint.sh
./docker/entrypoint.sh
@@ -777,11 +730,6 @@ jobs:
- run:
name: Run tests
command: |
- export PATH="$HOME/miniconda/bin:$PATH"
- source $HOME/miniconda/etc/profile.d/conda.sh
- conda activate myenv
- pwd
- ls
python -m pytest tests/proxy_security_tests -v -x --junitxml=test-results/junit.xml --durations=5
no_output_timeout: 15m
# Store test results