[Test] CI: add v2 migration resolver coverage with local Postgres
Adds end-to-end CI coverage for `--use_v2_migration_resolver` via a new job `installing_litellm_on_python_v2_migration_resolver`: - Clones the pytest smoke path from `installing_litellm_on_python` but uses a local Postgres sidecar instead of the shared DB to prevent collisions with the v1 variant. - Runs only the new `test_litellm_proxy_server_config_no_general_settings_v2_resolver` which spawns the proxy with `--use_v2_migration_resolver` and smoke-tests `/health/liveliness` and `/chat/completions`. Refactors `test_basic_python_version.py`: - Extracts the proxy spawn + smoke-test body into `_run_proxy_server_smoke_test` so the v1 and v2 tests share the same code path. - The existing `test_litellm_proxy_server_config_no_general_settings` is now a thin wrapper that passes no extra args (v1 default, unchanged). - Adds `..._v2_resolver` variant that passes `--use_v2_migration_resolver`. The existing `installing_litellm_on_python` / `installing_litellm_on_python_3_13` jobs filter out the v2 variant via `-k "not v2_resolver"` so they keep running only against their shared DB, unchanged behavior.
This commit is contained in:
parent
a16c00e22c
commit
ee550e1949
@ -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
|
||||
|
||||
@ -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"])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user