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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
[Infra] Migrate Redis caching tests from GHA to CircleCI
Yuneng Jiang3a02c0ac6b17
diff --git a/.circleci/config.yml b/.circleci/config.ymlindex 85c57886935..e6b9762380a 100644--- a/.circleci/config.yml+++ b/.circleci/config.yml@@ -1330,6 +1330,56 @@ jobs:paths:- audio_coverage.xml- audio_coverage+ redis_caching_unit_tests:+ docker:+ - image: cimg/python:3.11+ auth:+ username: ${DOCKERHUB_USERNAME}+ password: ${DOCKERHUB_PASSWORD}+ working_directory: ~/project++ steps:+ - checkout+ - setup_google_dns+ - run:+ name: Install Dependencies+ command: |+ python -m pip install --upgrade pip uv+ uv pip install --system -r requirements.txt+ pip install "pytest==7.3.1"+ pip install "pytest-retry==1.6.3"+ pip install "pytest-cov==5.0.0"+ pip install "pytest-asyncio==0.21.1"+ pip install "pytest-xdist==3.6.1"+ # Run pytest and generate JUnit XML report+ - run:+ name: Run tests+ command: |+ pwd+ ls+ python -m pytest -vv \+ tests/local_testing/test_dual_cache.py \+ tests/local_testing/test_redis_batch_optimizations.py \+ tests/local_testing/test_router_utils.py \+ --cov=litellm --cov-report=xml \+ -x -s -v --junitxml=test-results/junit.xml \+ --durations=5 -n 2 \+ --reruns 2 --reruns-delay 1+ no_output_timeout: 20m+ - run:+ name: Rename the coverage files+ command: |+ mv coverage.xml redis_caching_coverage.xml+ mv .coverage redis_caching_coverage++ # Store test results+ - store_test_results:+ path: test-results+ - persist_to_workspace:+ root: .+ paths:+ - redis_caching_coverage.xml+ - redis_caching_coverageinstalling_litellm_on_python:docker:- image: cimg/python:3.11@@ -3615,6 +3665,12 @@ workflows:only:- main- /litellm_.*/+ - redis_caching_unit_tests:+ filters:+ branches:+ only:+ - main+ - /litellm_.*/- upload-coverage:requires:- realtime_translation_testing@@ -3633,6 +3689,7 @@ workflows:- image_gen_testing- logging_testing- audio_testing+ - redis_caching_unit_tests- langfuse_logging_unit_tests- local_testing_part1- local_testing_part2diff --git a/.github/workflows/_test-unit-services-base.yml b/.github/workflows/_test-unit-services-base.ymlindex 7af3ab16c35..ce4c048c624 100644--- a/.github/workflows/_test-unit-services-base.yml+++ b/.github/workflows/_test-unit-services-base.yml@@ -27,11 +27,6 @@ on:required: falsetype: numberdefault: 10- enable-redis:- description: "Pass Redis Cloud credentials to tests via REDIS_HOST/PORT/PASSWORD env vars"- required: false- type: boolean- default: falseenable-postgres:description: "Start a local Postgres service container and run Prisma migrations"required: false@@ -43,12 +38,6 @@ on:type: stringdefault: "run"secrets:- REDIS_HOST:- required: false- REDIS_PORT:- required: false- REDIS_PASSWORD:- required: falseDATABASE_URL:required: falsePOSTGRES_USER:@@ -66,11 +55,8 @@ jobs:timeout-minutes: ${{ inputs.timeout-minutes }}# Environment is derived from the enable-* flags, not caller-controllable.# This prevents callers from passing arbitrary environment names to bypass secret scoping.- # Note: Postgres service container always starts (GHA limitation), so any Redis job- # also needs Postgres secrets → uses integration-redis-postgres, not integration-redis.environment: >-${{- inputs.enable-redis && 'integration-redis-postgres' ||inputs.enable-postgres && 'integration-postgres' ||''}}@@ -146,9 +132,6 @@ jobs:WORKERS: ${{ inputs.workers }}RERUNS: ${{ inputs.reruns }}DATABASE_URL: ${{ inputs.enable-postgres && secrets.DATABASE_URL || '' }}- REDIS_HOST: ${{ inputs.enable-redis && secrets.REDIS_HOST || '' }}- REDIS_PORT: ${{ inputs.enable-redis && secrets.REDIS_PORT || '' }}- REDIS_PASSWORD: ${{ inputs.enable-redis && secrets.REDIS_PASSWORD || '' }}run: |if [ "${WORKERS}" = "0" ]; thenpoetry run pytest ${TEST_PATH:?} \diff --git a/.github/workflows/test-unit-caching-redis.yml b/.github/workflows/test-unit-caching-redis.ymldeleted file mode 100644index 36305afc617..00000000000--- a/.github/workflows/test-unit-caching-redis.yml+++ /dev/null@@ -1,41 +0,0 @@-name: "Unit Tests: Caching (Redis)"--# Uses cloud Redis credentials — only runs on trusted branches, not PRs.-# This prevents external PRs from accessing Redis credentials.-on:- push:- branches: [main, "litellm_*"]--permissions:- contents: read- id-token: write- pull-requests: write--concurrency:- group: ${{ github.workflow }}-${{ github.ref }}- cancel-in-progress: true--jobs:- caching-redis:- uses: ./.github/workflows/_test-unit-services-base.yml- with:- # Redis-only tests that do NOT require provider API keys.- # Tests needing API keys (test_caching.py, test_caching_ssl.py, test_prometheus_service.py,- # test_router_caching.py) are in Phase 3 integration workflows.- test-path: >-- tests/local_testing/test_dual_cache.py- tests/local_testing/test_redis_batch_optimizations.py- tests/local_testing/test_router_utils.py- workers: 2- reruns: 2- timeout-minutes: 20- enable-redis: true- enable-postgres: false- artifact-name: caching-redis- secrets:- REDIS_HOST: ${{ secrets.REDIS_HOST }}- REDIS_PORT: ${{ secrets.REDIS_PORT }}- REDIS_PASSWORD: ${{ secrets.REDIS_PASSWORD }}- DATABASE_URL: ${{ secrets.DATABASE_URL }}- POSTGRES_USER: ${{ secrets.POSTGRES_USER }}- POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}diff --git a/.github/workflows/test-unit-proxy-db.yml b/.github/workflows/test-unit-proxy-db.ymlindex 1c764a96a3d..49d399e8741 100644--- a/.github/workflows/test-unit-proxy-db.yml+++ b/.github/workflows/test-unit-proxy-db.yml@@ -41,7 +41,6 @@ jobs:workers: ${{ matrix.workers }}reruns: 2timeout-minutes: ${{ matrix.timeout }}- enable-redis: falseenable-postgres: trueartifact-name: proxy-db-${{ matrix.test-group }}secrets:diff --git a/.github/workflows/test-unit-security.yml b/.github/workflows/test-unit-security.ymlindex 2e496d92636..76d3be3e63c 100644--- a/.github/workflows/test-unit-security.yml+++ b/.github/workflows/test-unit-security.yml@@ -22,7 +22,6 @@ jobs:workers: 1reruns: 2timeout-minutes: 20- enable-redis: falseenable-postgres: trueartifact-name: securitysecrets: