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]

Merge remote-tracking branch 'origin/main' into litellm_v2_migration_startup

Yuneng Jiang62f6ee9a16e4
diff --cc .circleci/config.yml
index c6e18c40213,87f1ee604cf..d44850234a7
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@@ -3030,34 -2921,107 +3037,133 @@@ jobs
exit 1
fi
+ provider_replay_harness:
+ docker:
+ - *python312_image
+ - image: redis@sha256:e2debfb7956fa12c7ddc79d7e645c8cf26b30c99a6e9161ea9bf4171e1668a5f
+ working_directory: ~/project
+ resource_class: medium
+ environment:
+ E2E_CACHE_TEST_REDIS_URL: redis://127.0.0.1:6379/0
+ E2E_PROVIDER_CACHE: "0"
+ E2E_FIXTURE_MODE: live
+ steps:
+ - checkout
+ - skip_if_unrelated_changes:
+ category: provider-harness
+ - setup_litellm_test_deps
+ - wait_for_service:
+ url: tcp://localhost:6379
+ - run:
+ name: Test provider capture and replay harness
+ command: |
+ mkdir -p test-results/provider-replay-harness
+ uv run --no-sync pytest -q --noconftest -o addopts= -o pythonpath=tests/e2e -p no:rerunfailures \
+ --junitxml=test-results/provider-replay-harness/junit.xml \
+ tests/e2e/test_provider_edge.py tests/e2e/test_fixture_bundle.py \
+ tests/e2e/test_fixture_canonical.py tests/e2e/test_fixture_mode.py \
+ tests/code_coverage_tests/test_provider_replay_harness.py \
+ tests/code_coverage_tests/test_provider_cache.py
+ - store_test_results:
+ path: test-results/provider-replay-harness
+
+ integration_contracts:
+ parameters:
+ suite:
+ type: string
+ machine:
+ image: ubuntu-2204:2024.04.1
+ resource_class: large
+ working_directory: ~/project
+ steps:
+ - setup_litellm_test_deps
+ - when:
+ condition:
+ equal: [browser, << parameters.suite >>]
+ steps:
+ - install_node
+ - restore_cache:
+ keys:
+ - integration-ui-v3-{{ checksum "ui/litellm-dashboard/package-lock.json" }}-{{ checksum "tests/e2e/ui/package-lock.json" }}
+ - run:
+ name: Install locked browser dependencies
+ command: |
+ cd ui/litellm-dashboard
+ npm ci
+ cd ../../tests/e2e/ui
+ npm ci
+ sudo env PATH="$PATH" DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l \
+ timeout --signal=TERM --kill-after=20s 6m node node_modules/@playwright/test/cli.js install-deps chromium
+ timeout --signal=TERM --kill-after=20s 3m node node_modules/@playwright/test/cli.js install chromium
+ - save_cache:
+ key: integration-ui-v3-{{ checksum "ui/litellm-dashboard/package-lock.json" }}-{{ checksum "tests/e2e/ui/package-lock.json" }}
+ paths:
+ - ~/.npm
+ - ~/.cache/ms-playwright
+ - run:
+ name: Build the candidate dashboard
+ command: cd ui/litellm-dashboard && NEXT_TELEMETRY_DISABLED=1 npm run build
+ - start_postgres:
+ image: postgres:16@sha256:e17e86066e5ef83e0952a9347f5c792b7ece00972e2aa787a6986f471b3dd3d5
+ - start_redis
+ - run:
+ name: Run owned integration contracts
+ command: bash .circleci/scripts/run_integration.sh << parameters.suite >>
+ no_output_timeout: 15m
+ - run:
+ name: Stop owned database and Redis
+ when: always
+ command: |
+ mkdir -p test-results/integration-<< parameters.suite >>
+ docker logs postgres-db > test-results/integration-<< parameters.suite >>/postgres.log 2>&1 || true
+ docker logs redis-cache > test-results/integration-<< parameters.suite >>/redis.log 2>&1 || true
+ docker rm -f postgres-db redis-cache
+ test -z "$(docker ps -aq --filter name=postgres-db --filter name=redis-cache)"
+ - store_test_results:
+ path: test-results
+ - store_artifacts:
+ path: test-results
+
workflows:
+ migration_startup:
+ when: << pipeline.parameters.run_migration_tests >>
+ jobs: &migration_jobs
+ - build_docker_database_image:
+ migration_qualification: true
+ - migration_startup_tests:
+ name: migration-startup
+ suite: startup
+ requires: [build_docker_database_image]
+ - migration_startup_tests:
+ name: migration-recovery
+ suite: recovery
+ requires: [build_docker_database_image]
+ - migration_startup_tests:
+ name: migration-legacy-and-pooling
+ suite: legacy
+ requires: [build_docker_database_image]
+ migration_startup_scheduled:
+ triggers:
+ - schedule:
+ cron: "17 0,6,12,18 * * *"
+ filters:
+ branches:
+ only: litellm_internal_staging
+ jobs: *migration_jobs
+ integration:
+ jobs:
+ - integration_contracts:
+ name: integration-<< matrix.suite >>
+ matrix:
+ parameters:
+ suite: [management, accounting, database, providers, extensions, sdk, browser]
+ filters:
+ branches:
+ only:
+ - main
+ - /litellm_.*/
build_and_test:
+ unless: << pipeline.parameters.run_migration_tests >>
jobs:
- using_litellm_on_windows:
filters: &main_branches
diff --cc tests/e2e/conftest.py
index 53d35effdc9,e83827fac74..3f399aa016d
--- a/tests/e2e/conftest.py
+++ b/tests/e2e/conftest.py
@@@ -64,9 -88,11 +88,14 @@@ def jwt_identity(idp: Keycloak, resourc
def pytest_configure(config: pytest.Config) -> None:
+ config.addinivalue_line(
+ "markers", "migration_startup: isolated container startup tests run by the migration CI workflow"
+ )
+ config.addinivalue_line(
+ "markers",
+ "provider_live: requires actual provider timing, limits, state, or a response that echoes this"
+ " run's own unique value; bypass shared cache",
+ )
config.addinivalue_line(
"markers",
"e2e: live test that requires a running proxy and real provider keys",
@@@ -124,13 -171,12 +174,17 @@@ def pytest_collection_modifyitems(confi
Also sort `load`-marked items last so a whole-tree run drives heavy throughput
traffic only after the latency-sensitive suites have finished."""
+ deselected = [item for item in items if _needs_unset_opt_in(item)]
+ if deselected:
+ config.hook.pytest_deselected(items=deselected)
+ items[:] = [item for item in items if not _needs_unset_opt_in(item)]
for item in items:
attach_result_properties(item)
+ if os.environ.get("LITELLM_MIGRATION_TESTS") != "1":
+ deselected = [item for item in items if item.get_closest_marker("migration_startup") is not None]
+ items[:] = [item for item in items if item.get_closest_marker("migration_startup") is None]
+ if deselected:
+ deselected[0].config.hook.pytest_deselected(items=deselected)
items.sort(key=lambda item: item.get_closest_marker("load") is not None)
@@@ -163,7 -210,8 +218,8 @@@ def pytest_runtest_setup(item: pytest.I
Unmarked tests (unit coverage of the harness) don't touch the proxy, so they
run even when none is up. Never skip for a missing proxy. Replay mode needs
the proxy too: only provider-bound traffic replays from the bundle."""
+ LIVE_PROVIDER_REQUIRED.set(item.get_closest_marker("provider_live") is not None)
- if item.get_closest_marker("e2e") is None:
+ if item.get_closest_marker("e2e") is None or item.get_closest_marker("migration_startup") is not None:
return
reason = _proxy_fail_reason()
if reason is not None: