Skip to content

ci: move tests/proxy_unit_tests to tests/unit/proxy and run the proxy-db shards from litellm-tests - #42903

Merged
yuneng-berri merged 19 commits into
mainfrom
litellm_ci_mig_4_proxy
Sep 24, 2026
Merged

yuneng-berri merged 19 commits into
mainfrom
litellm_ci_mig_4_proxy

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Stack 4/5 of the split of #42831 (reference PR, stays open until the stack lands). Below: #42902. Above: #42904. Carved from litellm_ci_migration_proxy_misc at c17f440 with git checkout <branch> -- <paths> and git checkout -p for the shared CI files, no rewrites

TLDR

Problem this solves:

  • tests/proxy_unit_tests lives outside tests/unit and only runs from GitHub Actions

How it solves it:

  • tests/proxy_unit_tests -> tests/unit/proxy with its conftest.py, test_configs, .env, fixtures and audio files
  • test_skills_db.py -> tests/unit/skills
  • twelve proxy-db-* groups in unit_selection.sh, one tests.yml job each with reruns: 2 and Prisma setup
  • test-unit-proxy-db.yml keeps its check names, runs the moved paths on fork PRs only
  • remaining path refs: Makefile, classify_changes.sh, assert_ci_coverage.py, test-unit.yml, test_circleci_path_filter.py, user_api_key_auth_code_coverage.py, test_azure_routes.py, skills README

Renames

git diff -M --stat litellm_ci_mig_3_small_trees litellm_ci_mig_4_proxy: 73 renames, 69 at 100 percent. The four below 100 percent are path edits only: test_jwt_key_mapping.py (sys.path.insert gains two ../), test_proxy_config_unit_test.py (os.listdir filtered to yaml files because the package now has __init__.py), test_proxy_server.py (two sibling imports become tests.unit.proxy... absolute imports), test_skills_db.py (Path(__file__).parents[2] for the fixtures dir). The empty test_key_generate_dynamodb.py is deleted rather than moved

 .circleci/scripts/classify_changes.sh                                                            |   2 +-
 .circleci/scripts/unit_selection.sh                                                              |  72 ++++++++++++++++++++++++++
 .circleci/tests.yml                                                                              |  30 ++++++++++-
 .github/scripts/assert_ci_coverage.py                                                            |   1 -
 .github/workflows/test-unit-proxy-db.yml                                                         |  97 ++++++++++++-----------------------
 .github/workflows/test-unit.yml                                                                  |   8 +--
 Makefile                                                                                         |  10 ++--
 litellm/llms/litellm_proxy/skills/README.md                                                      |   2 +-
 tests/code_coverage_tests/user_api_key_auth_code_coverage.py                                     |   4 +-
 tests/test_litellm/proxy/image_endpoints/test_azure_routes.py                                    |   3 +-
 tests/test_litellm/test_circleci_path_filter.py                                                  |   2 +-
 tests/{proxy_unit_tests/test_key_generate_dynamodb.py => unit/proxy/__init__.py}                 |   0
 tests/unit/proxy/auth/__init__.py                                                                |   0
 tests/{proxy_unit_tests => unit/proxy/auth}/test_auth_checks.py                                  |   0
 tests/{proxy_unit_tests => unit/proxy/auth}/test_default_end_user_budget_simple.py               |   0
 tests/{proxy_unit_tests => unit/proxy/auth}/test_jwt.py                                          |   0
 tests/{proxy_unit_tests => unit/proxy/auth}/test_models_fallback_endpoint.py                     |   0
 tests/{proxy_unit_tests => unit/proxy/auth}/test_multipart_bypass_repro.py                       |   0
 tests/{proxy_unit_tests => unit/proxy/auth}/test_proxy_routes.py                                 |   0
 tests/{proxy_unit_tests => unit/proxy/auth}/test_user_api_key_auth.py                            |   0
 tests/unit/proxy/common_utils/__init__.py                                                        |   0
 tests/{proxy_unit_tests => unit/proxy/common_utils}/test_check_batch_cost.py                     |   0
 tests/{proxy_unit_tests => unit/proxy/common_utils}/test_check_responses_cost.py                 |   0
 tests/{proxy_unit_tests => unit/proxy/common_utils}/test_proxy_encrypt_decrypt.py                |   0
 tests/{proxy_unit_tests => unit/proxy/common_utils}/test_realtime_cache.py                       |   0
 tests/unit/proxy/conftest.py                                                                     | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/unit/proxy/db/__init__.py                                                                  |   0
 tests/unit/proxy/db/db_transaction_queue/__init__.py                                             |   0
 tests/{proxy_unit_tests => unit/proxy/db/db_transaction_queue}/test_e2e_pod_lock_manager.py      |   0
 tests/{proxy_unit_tests => unit/proxy/db}/test_update_daily_tag_spend.py                         |   0
 tests/unit/proxy/example_config_yaml/__init__.py                                                 |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/aliases_config.yaml                   |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/azure_config.yaml                     |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/cache_no_params.yaml                  |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/cache_with_params.yaml                |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/config_with_env_vars.yaml             |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/config_with_include.yaml              |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/config_with_missing_include.yaml      |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/config_with_multiple_includes.yaml    |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/included_models.yaml                  |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/langfuse_config.yaml                  |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/load_balancer.yaml                    |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/models_file_1.yaml                    |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/models_file_2.yaml                    |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/opentelemetry_config.yaml             |   0
 tests/{proxy_unit_tests => unit/proxy}/example_config_yaml/simple_config.yaml                    |   0
 tests/unit/proxy/google_endpoints/__init__.py                                                    |   0
 tests/{proxy_unit_tests => unit/proxy/google_endpoints}/test_gemini_agents_endpoints.py          |   0
 tests/{proxy_unit_tests => unit/proxy/google_endpoints}/test_google_endpoint_routing.py          |   0
 tests/{proxy_unit_tests => unit/proxy/google_endpoints}/test_google_gemini_proxy_request.py      |   0
 tests/unit/proxy/hooks/__init__.py                                                               |   0
 tests/{proxy_unit_tests => unit/proxy/hooks}/test_banned_keyword_list.py                         |   0
 tests/{proxy_unit_tests => unit/proxy/hooks}/test_unit_test_max_model_budget_limiter.py          |   0
 tests/unit/proxy/management_endpoints/__init__.py                                                |   0
 tests/{proxy_unit_tests => unit/proxy/management_endpoints}/test_jwt_key_mapping.py              |   2 +-
 tests/{proxy_unit_tests => unit/proxy/management_endpoints}/test_key_generate_prisma.py          |   0
 tests/unit/proxy/management_helpers/__init__.py                                                  |   0
 tests/{proxy_unit_tests => unit/proxy/management_helpers}/test_audit_logs_proxy.py               |   0
 tests/unit/proxy/middleware/__init__.py                                                          |   0
 tests/{proxy_unit_tests => unit/proxy/middleware}/test_request_size_limit_middleware.py          |   0
 tests/unit/proxy/public_endpoints/__init__.py                                                    |   0
 tests/{proxy_unit_tests => unit/proxy/public_endpoints}/test_blog_posts_endpoint.py              |   0
 tests/unit/proxy/response_polling/__init__.py                                                    |   0
 tests/{proxy_unit_tests => unit/proxy/response_polling}/test_response_polling_handler.py         |   0
 tests/unit/proxy/spend_tracking/__init__.py                                                      |   0
 tests/{proxy_unit_tests => unit/proxy/spend_tracking}/test_search_api_logging.py                 |   0
 tests/{proxy_unit_tests => unit/proxy}/test_aproxy_startup.py                                    |   0
 tests/unit/proxy/test_configs/__init__.py                                                        |   0
 tests/{proxy_unit_tests => unit/proxy}/test_configs/custom_auth.py                               |   0
 tests/{proxy_unit_tests => unit/proxy}/test_configs/test_cloudflare_azure_with_cache_config.yaml |   0
 tests/{proxy_unit_tests => unit/proxy}/test_configs/test_config.yaml                             |   0
 tests/{proxy_unit_tests => unit/proxy}/test_configs/test_config_custom_auth.yaml                 |   0
 tests/{proxy_unit_tests => unit/proxy}/test_configs/test_config_no_auth.yaml                     |   0
 tests/{proxy_unit_tests => unit/proxy}/test_configs/test_guardrails_config.yaml                  |   0
 tests/{proxy_unit_tests => unit/proxy}/test_custom_callback_input.py                             |   0
 tests/{proxy_unit_tests => unit/proxy}/test_custom_logger_s3_gcs.py                              |   0
 tests/{proxy_unit_tests => unit/proxy}/test_custom_tokenizer_bug.py                              |   0
 tests/{proxy_unit_tests => unit/proxy}/test_db_schema_changes.py                                 |   0
 tests/{proxy_unit_tests => unit/proxy}/test_deprecated_key_grace_period.py                       |   0
 tests/{proxy_unit_tests => unit/proxy}/test_get_favicon.py                                       |   0
 tests/{proxy_unit_tests => unit/proxy}/test_get_image.py                                         |   0
 tests/{proxy_unit_tests => unit/proxy}/test_prisma_client_backoff_retry.py                       |   0
 tests/{proxy_unit_tests => unit/proxy}/test_prompt_test_endpoint.py                              |   0
 tests/{proxy_unit_tests => unit/proxy}/test_proxy_config_unit_test.py                            |   2 +-
 tests/{proxy_unit_tests => unit/proxy}/test_proxy_custom_auth.py                                 |   0
 tests/{proxy_unit_tests => unit/proxy}/test_proxy_reject_logging.py                              |   0
 tests/{proxy_unit_tests => unit/proxy}/test_proxy_server.py                                      |   4 +-
 tests/{proxy_unit_tests => unit/proxy}/test_proxy_setting_guardrails.py                          |   0
 tests/{proxy_unit_tests => unit/proxy}/test_proxy_token_counter.py                               |   0
 tests/{proxy_unit_tests => unit/proxy}/test_proxy_utils.py                                       |   0
 tests/{proxy_unit_tests => unit/proxy}/test_reducto_ocr_route.py                                 |   0
 tests/{proxy_unit_tests => unit/proxy}/test_response_polling_pre_call_checks.py                  |   0
 tests/{proxy_unit_tests => unit/proxy}/test_server_root_path.py                                  |   0
 tests/{proxy_unit_tests => unit/proxy}/test_ui_path_detection.py                                 |   0
 tests/{proxy_unit_tests => unit/proxy}/test_unit_test_proxy_hooks.py                             |   0
 tests/{proxy_unit_tests => unit/proxy}/test_update_spend.py                                      |   0
 tests/{proxy_unit_tests => unit/proxy}/test_zero_cost_model_budget_bypass.py                     |   0
 tests/{proxy_unit_tests => unit/proxy}/vertex_key.json                                           |   0
 tests/{proxy_unit_tests => unit/skills}/test_skills_db.py                                        |   2 +-
 tests/unit/skills/test_skills_main.py                                                            |   2 +-
 100 files changed, 305 insertions(+), 88 deletions(-)

Type

🚄 Infrastructure
✅ Test

Screenshots / Proof of Fix

litellm-tests on this head: https://app.circleci.com/pipelines/github/BerriAI/litellm/90352

Locally, all twelve proxy-db-* groups through unit_selection.sh under the same env -i allowlist with outbound network blocked are green, assert_ci_coverage.py reports every test file owned by a job, and test_assert_ci_coverage.py plus test_circleci_path_filter.py pass (101 tests)

Greptile follow-up in d9b14ca: make test-proxy-unit-a runs tests/unit/proxy minus test_[p-z]*.py and test-proxy-unit-b adds tests/unit/skills, so together they collect all 1129 tests of the moved tree instead of only the top-level files

Caveats (if any)

Low

  • test_proxy_token_counter.py carries two failures inherited from main, unchanged by the move (see stack 2)

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally
  • My PR passes all required CI/CD checks
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Link to Devin session: https://app.devin.ai/sessions/d541aba7e5844703bab65085ef2d54b2
Open in Devin Desktop: https://app.devin.ai/desktop/session/d541aba7e5844703bab65085ef2d54b2?variant=devin

… synthetic values and integration and e2e coverage
…ts/unit and run them from litellm-tests under their legacy flags
…ts/unit and run them from litellm-tests under their legacy flags
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no new actionable issue remains.

Summary

This PR moves proxy tests into tests/unit, assigns the database-dependent tests to twelve CircleCI shards, and retains GitHub Actions coverage for fork PRs. The previously reported local-target issue is fixed; the other previous findings were withdrawn.

Reviews (7) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..."

Comment thread Makefile Outdated
Comment thread .github/scripts/assert_ci_coverage.py
@devin-ai-integration
devin-ai-integration Bot force-pushed the litellm_ci_mig_3_small_trees branch from bb62bba to 8f8d572 Compare September 24, 2026 08:27
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

1 similar comment
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai

Comment thread tests/unit/proxy/conftest.py
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai

@devin-ai-integration
devin-ai-integration Bot force-pushed the litellm_ci_mig_3_small_trees branch from d1e2cda to 715975f Compare September 24, 2026 22:39
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai

Base automatically changed from litellm_ci_mig_3_small_trees to main September 24, 2026 22:50
@yuneng-berri
yuneng-berri requested a review from a team September 24, 2026 22:50
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai

@yuneng-berri
yuneng-berri enabled auto-merge (squash) September 24, 2026 22:51
@yuneng-berri
yuneng-berri merged commit 248f0eb into main Sep 24, 2026
100 of 120 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_ci_mig_4_proxy branch September 24, 2026 22:59
@codspeed

codspeed Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_ci_mig_4_proxy (c82cc13) with main (040b37f)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (bf01870) during the generation of this report, so 040b37f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

yuneng-berri added a commit that referenced this pull request Sep 26, 2026
…3266)

test_update_config_success_callback_normalization replaced
proxy_server.proxy_logging_obj with a MagicMock and never restored it.
Since the proxy unit tests joined tests/unit (#42903), 14 JWT mapping,
end-user and MCP tests on the same xdist worker awaited that mock and
failed. The test now uses monkeypatch.

test_prometheus_logging_callbacks set verbose_logger to DEBUG and
litellm.set_verbose at import, so every worker in the unit job ran with
DEBUG on. That broke caplog equality in the JEV classifier test, the
vertex streaming memory ratio, and four event-loop lag checks. The
module-level setup is removed; nothing in the file depended on it.

#43081 removed the OCR harness modules but left them in the
importability parametrize list.

test_get_model_info_bedrock_region reassigned litellm.model_cost and set
LITELLM_LOCAL_MODEL_COST_MAP without restoring either, and never cleared
the get_model_info caches, so it failed whenever an earlier test had
looked up the regional model. It now uses monkeypatch and invalidates
the caches; the local_testing isolation fixture also invalidates them
after restoring model_cost.

The Windows job hit CircleCI's 10 minute no-output limit while cargo
compiles the Rust crates inside uv sync and uv build. Those two steps now
allow 30 minutes of silence.
yuneng-berri added a commit that referenced this pull request Sep 26, 2026
…3266)

test_update_config_success_callback_normalization replaced
proxy_server.proxy_logging_obj with a MagicMock and never restored it.
Since the proxy unit tests joined tests/unit (#42903), 14 JWT mapping,
end-user and MCP tests on the same xdist worker awaited that mock and
failed. The test now uses monkeypatch.

test_prometheus_logging_callbacks set verbose_logger to DEBUG and
litellm.set_verbose at import, so every worker in the unit job ran with
DEBUG on. That broke caplog equality in the JEV classifier test, the
vertex streaming memory ratio, and four event-loop lag checks. The
module-level setup is removed; nothing in the file depended on it.

#43081 removed the OCR harness modules but left them in the
importability parametrize list.

test_get_model_info_bedrock_region reassigned litellm.model_cost and set
LITELLM_LOCAL_MODEL_COST_MAP without restoring either, and never cleared
the get_model_info caches, so it failed whenever an earlier test had
looked up the regional model. It now uses monkeypatch and invalidates
the caches; the local_testing isolation fixture also invalidates them
after restoring model_cost.

The Windows job hit CircleCI's 10 minute no-output limit while cargo
compiles the Rust crates inside uv sync and uv build. Those two steps now
allow 30 minutes of silence.

(cherry picked from commit 7fc2206)
yuneng-berri added a commit that referenced this pull request Sep 26, 2026
…3266) (#43267)

test_update_config_success_callback_normalization replaced
proxy_server.proxy_logging_obj with a MagicMock and never restored it.
Since the proxy unit tests joined tests/unit (#42903), 14 JWT mapping,
end-user and MCP tests on the same xdist worker awaited that mock and
failed. The test now uses monkeypatch.

test_prometheus_logging_callbacks set verbose_logger to DEBUG and
litellm.set_verbose at import, so every worker in the unit job ran with
DEBUG on. That broke caplog equality in the JEV classifier test, the
vertex streaming memory ratio, and four event-loop lag checks. The
module-level setup is removed; nothing in the file depended on it.

#43081 removed the OCR harness modules but left them in the
importability parametrize list.

test_get_model_info_bedrock_region reassigned litellm.model_cost and set
LITELLM_LOCAL_MODEL_COST_MAP without restoring either, and never cleared
the get_model_info caches, so it failed whenever an earlier test had
looked up the regional model. It now uses monkeypatch and invalidates
the caches; the local_testing isolation fixture also invalidates them
after restoring model_cost.

The Windows job hit CircleCI's 10 minute no-output limit while cargo
compiles the Rust crates inside uv sync and uv build. Those two steps now
allow 30 minutes of silence.

(cherry picked from commit 7fc2206)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants