Skip to content

test(proxy): move middleware, spend_tracking, pass_through, common_utils and root proxy tests into tests/unit/proxy - #44015

Merged
yuneng-berri merged 1 commit into
mainfrom
litellm_migrate_proxy_tests_p6
Oct 1, 2026
Merged

yuneng-berri merged 1 commit into
mainfrom
litellm_migrate_proxy_tests_p6

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • tests/test_litellm/proxy still holds middleware, spend_tracking, pass_through, common_utils and root tests
  • They belong in the unit tier at tests/unit/proxy/<same path>

How it solves it:

  • git mv of eight dirs, test_configs and the 79 root test_*.py (184 renames)
  • Ports the legacy conftest helpers the moved tests use into tests/unit/proxy/conftest.py
  • Rewrites the proxy-infra shard paths in test-unit.yml, shard name unchanged

PR 6 of 7, stacked on #44012. pass_through_endpoints/test_pass_through_endpoints.py stays at the legacy path with its conftest because it holds the live httpbin test, which PR 7 rewrites against a loopback server

Screenshots / Proof of Fix

Coverage ledger

Same ledger.py as #43998, base origin/litellm_migrate_proxy_tests_p5

base origin/litellm_migrate_proxy_tests_p5: 5462 node ids in 184 legacy files
head litellm_migrate_proxy_tests_p6: 5462 node ids
renamed files: 184, deleted legacy files: 0
carried over after path mapping: 5462
missing explained: 0
missing unexplained: 0
head ids with no base counterpart: 0

The 537 ids in the staying test_pass_through_endpoints.py collect the same as on the base

Ownership

Everything moved runs in proxy-infra. The root files are listed one by one, since tests/unit/proxy already has 27 root files that test-unit-proxy-db.yml and other shards own. Seven pre-existing destination files in common_utils, middleware and spend_tracking are on .circleci/scripts/unit_selection.sh for proxy-db, so proxy-infra ignores them and each file runs in exactly one GHA shard. test-unit-proxy-misc in the Makefile selects the same set through a PROXY_INFRA_ROOT_TESTS variable. assert_ci_coverage.py prints OK in every mode, and tests/unit/test_package_layout.py passes

Runs

Moved set, env -i with outbound sockets blocked, -n 4 --timeout=120: 5463 passed, 2 skipped. Two tests fail locally the same way at the legacy path on the base: test_gateway_plus_backend_covers_full_app (a child -I interpreter imports litellm from the main checkout instead of the worktree) and test_prometheus_metrics_port_starts_separate_metrics_process. The proxy-db-owned destination files, run separately: 150 passed, 1 skipped

A probe recorded every non-loopback socket.connect, connect_ex and getaddrinfo across the moved set. It recorded nothing, so no HTTP stubs were needed

Non-rename edits

file +/- reason
.github/workflows/test-unit.yml 94/8 proxy-infra paths and ignores described above
Makefile 82/1 test-unit-proxy-misc mirrors the proxy-infra selection
tests/unit/proxy/conftest.py 170/1 ports build_cache_config, build_minimal_proxy_config, set_proxy_environment_variables, create_proxy_test_client and fresh_agent_read_through from the legacy conftest
test_configs/test_config_no_auth.yaml rename collides with a different destination file, so it lands as test_config_hosted_vllm_embedding.yaml and its two readers point there
test_redis_auth_cache_flag.py 2/0 _patched_init_cache left litellm_config_cache unpatched, so _init_cache stored a fake Redis cache in the real global. The destination conftest sorts items by name, which put common_utils/test_periodic_reload_schedule.py after it and broke those tests. It now patches that global like the other three caches
experimental/mcp_server/test_tool_registry.py 1/1 the config handler test_tool_registry.example_handler only resolved as a top-level module. Now that the dir is a package it is the full dotted path
test_proxy_cli.py 5/5 LITELLM_WORKER_STARTUP_HOOKS module strings follow the move
health_endpoints/test_health_endpoints.py 1/1 helper import from tests.unit.proxy.conftest
test_enforce_user_param.py, scripts/test_tool_allowlist_script.py, CONTRIBUTING.md, SPEND_TRACKING_COVERAGE_MATRIX.md, tests/test_spend_logs.py 1 or 2 each path strings
6 new __init__.py 0/0 empty package markers for moved dirs

Type

✅ Test

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/d9bda95617da464e88d3619765819d0e
Open in Devin Desktop: https://app.devin.ai/desktop/session/d9bda95617da464e88d3619765819d0e?variant=devin

@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

@devin-ai-integration
devin-ai-integration Bot force-pushed the litellm_migrate_proxy_tests_p5 branch from 4e1278e to 08350ee Compare October 1, 2026 12:47
@devin-ai-integration
devin-ai-integration Bot force-pushed the litellm_migrate_proxy_tests_p6 branch from f14df79 to e79897b Compare October 1, 2026 12:47
@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Low risk] Reorganizes test files into a unified directory structure.

The PR appears safe to merge; no actionable regression was established.

Summary

This PR relocates proxy tests into tests/unit/proxy, ports shared test helpers, and updates CI and Makefile selections while retaining the legacy pass-through test pending its separate migration.

Reviews (1) · Last reviewed commit: f14df79

@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@devin-ai-integration
devin-ai-integration Bot force-pushed the litellm_migrate_proxy_tests_p5 branch from 08350ee to 2da439c Compare October 1, 2026 14:13
@devin-ai-integration
devin-ai-integration Bot force-pushed the litellm_migrate_proxy_tests_p6 branch from e79897b to a620b30 Compare October 1, 2026 14:13
@devin-ai-integration
devin-ai-integration Bot force-pushed the litellm_migrate_proxy_tests_p5 branch from 2da439c to 8b8dc59 Compare October 1, 2026 16:33
@devin-ai-integration
devin-ai-integration Bot force-pushed the litellm_migrate_proxy_tests_p6 branch from a620b30 to 8c84336 Compare October 1, 2026 16:35
@yuneng-berri
yuneng-berri force-pushed the litellm_migrate_proxy_tests_p5 branch from 8b8dc59 to 7814e2c Compare October 1, 2026 17:53
@yuneng-berri
yuneng-berri force-pushed the litellm_migrate_proxy_tests_p6 branch 2 times, most recently from c7bbab0 to a03f35e Compare October 1, 2026 18:07
@yuneng-berri
yuneng-berri force-pushed the litellm_migrate_proxy_tests_p5 branch from 7814e2c to 4f02a99 Compare October 1, 2026 18:07
Base automatically changed from litellm_migrate_proxy_tests_p5 to main October 1, 2026 18:14
@devin-ai-integration
devin-ai-integration Bot requested a review from a team October 1, 2026 18:14
…ils and root proxy tests into tests/unit/proxy

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@yuneng-berri
yuneng-berri force-pushed the litellm_migrate_proxy_tests_p6 branch from a03f35e to 928c73a Compare October 1, 2026 18:14
@yuneng-berri
yuneng-berri enabled auto-merge (squash) October 1, 2026 18:17
@yuneng-berri
yuneng-berri merged commit a76b59d into main Oct 1, 2026
90 of 94 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_migrate_proxy_tests_p6 branch October 1, 2026 18:23
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.

1 participant