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] CI: add v2 migration resolver coverage with local Postgres

Yuneng Jiangee550e194949
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8c75bdc5f33..db8e7d49d71 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1529,7 +1529,50 @@ jobs:
command: |
pwd
ls
- uv run --no-sync python -m pytest -vv tests/local_testing/test_basic_python_version.py
+ uv run --no-sync python -m pytest -vv tests/local_testing/test_basic_python_version.py -k "not v2_resolver"
+
+ installing_litellm_on_python_v2_migration_resolver:
+ docker:
+ - image: cimg/python:3.11
+ auth:
+ username: ${DOCKERHUB_USERNAME}
+ password: ${DOCKERHUB_PASSWORD}
+ - image: cimg/postgres:16.0
+ environment:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: postgres
+ POSTGRES_DB: litellm_test
+ working_directory: ~/project
+ environment:
+ DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/litellm_test"
+
+ steps:
+ - checkout
+ - setup_google_dns
+ - run:
+ name: Install Dependencies
+ command: |
+ curl -LsSf -o /tmp/uv-install.sh https://astral.sh/uv/0.10.9/install.sh
+ echo "7fc46e39cb97290b57169c0c813a17970585ac519139f19006453c99b5f2f45f /tmp/uv-install.sh" | sha256sum -c -
+ env UV_NO_MODIFY_PATH=1 sh /tmp/uv-install.sh
+ rm -f /tmp/uv-install.sh
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$BASH_ENV"
+ export PATH="$HOME/.local/bin:$PATH"
+ if [ -f "$HOME/miniconda/etc/profile.d/conda.sh" ]; then
+ export PATH="$HOME/miniconda/bin:$PATH"
+ source "$HOME/miniconda/etc/profile.d/conda.sh"
+ conda activate myenv
+ fi
+ uv sync --frozen --all-groups --all-extras --python "$(which python)"
+ - setup_litellm_enterprise_pip
+ - wait_for_service:
+ url: tcp://localhost:5432
+ timeout: "60"
+ - run:
+ name: Run v2 migration resolver proxy smoke test
+ command: |
+ uv run --no-sync python -m pytest -vv \
+ tests/local_testing/test_basic_python_version.py::test_litellm_proxy_server_config_no_general_settings_v2_resolver
installing_litellm_on_python_3_13:
docker:
@@ -1563,7 +1606,7 @@ jobs:
command: |
pwd
ls
- uv run --no-sync python -m pytest -v tests/local_testing/test_basic_python_version.py
+ uv run --no-sync python -m pytest -v tests/local_testing/test_basic_python_version.py -k "not v2_resolver"
helm_chart_testing:
machine:
image: ubuntu-2204:2023.10.1 # Use machine executor instead of docker
@@ -3544,6 +3587,12 @@ workflows:
only:
- main
- /litellm_.*/
+ - installing_litellm_on_python_v2_migration_resolver:
+ filters:
+ branches:
+ only:
+ - main
+ - /litellm_.*/
- helm_chart_testing:
requires:
- build_docker_database_image
diff --git a/tests/local_testing/test_basic_python_version.py b/tests/local_testing/test_basic_python_version.py
index 37e23d64677..8308e0d6033 100644
--- a/tests/local_testing/test_basic_python_version.py
+++ b/tests/local_testing/test_basic_python_version.py
@@ -100,8 +100,12 @@ import pytest
import requests
-def test_litellm_proxy_server_config_no_general_settings():
- # Sync the local litellm packages into the project environment
+def _run_proxy_server_smoke_test(extra_proxy_args=None):
+ """Sync deps, generate Prisma client, start proxy with optional extra args,
+ send a health check + chat/completions request, and tear down."""
+ if extra_proxy_args is None:
+ extra_proxy_args = []
+
server_process = None
try:
_run_uv(
@@ -144,6 +148,7 @@ def test_litellm_proxy_server_config_no_general_settings():
"litellm.proxy.proxy_cli",
"--config",
config_fp,
+ *extra_proxy_args,
],
cwd=PROJECT_ROOT,
)
@@ -182,3 +187,17 @@ def test_litellm_proxy_server_config_no_general_settings():
# Additional assertions can be added here
assert True
+
+
+def test_litellm_proxy_server_config_no_general_settings():
+ """Exercises the default (v1) migration resolver."""
+ _run_proxy_server_smoke_test()
+
+
+def test_litellm_proxy_server_config_no_general_settings_v2_resolver():
+ """Exercises the opt-in v2 migration resolver.
+
+ Runs in a separate CI job against a local Postgres to avoid collisions
+ with the v1 variant when they share a database.
+ """
+ _run_proxy_server_smoke_test(extra_proxy_args=["--use_v2_migration_resolver"])