Skip to content

test(proxy): delete the legacy proxy test tree and shard tests/unit/proxy by glob - #44018

Merged
yuneng-berri merged 7 commits into
mainfrom
litellm_migrate_proxy_tests_p7
Oct 1, 2026
Merged

yuneng-berri merged 7 commits into
mainfrom
litellm_migrate_proxy_tests_p7

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • tests/test_litellm/proxy still held one pass-through file, its conftest and package markers
  • The redirect test hit live httpbin.org and turned any failure into a skip
  • New files under tests/unit/proxy would land in no GHA shard, with nothing flagging it

How it solves it:

  • git mv of the last file, then the legacy conftest and __init__.py files are deleted
  • The redirect test is served in-process by respx, with no socket and no skip wrapper
  • SHARDED_ROOTS names tests/unit/proxy, and the root files are a tests/unit/proxy/test_*.py glob in a new proxy-infra-root shard
  • --shards also counts paths unit_selection.sh adds for a flag, but only when some GHA unit-flag: wires that flag

PR 7 of 7, stacked on #44015. After it, tests/test_litellm/proxy no longer exists

Screenshots / Proof of Fix

Coverage ledger

Same ledger.py as the rest of the stack, base origin/litellm_migrate_proxy_tests_p6

base origin/litellm_migrate_proxy_tests_p6: 537 node ids in 3 legacy files
head origin/litellm_migrate_proxy_tests_p7: 537 node ids
renamed files: 1, deleted legacy files: 2
carried over after path mapping: 536
missing explained: 0
missing unexplained: 1
  tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.py::test_pass_through_with_httpbin_redirect
head ids with no base counterpart: 1
  tests/unit/proxy/pass_through_endpoints/test_pass_through_endpoints.py::test_pass_through_request_follows_redirect_to_final_response

The single pair is the redirect test rename, so every id is accounted for. The two deleted legacy files are conftest.py and __init__.py, and test ! -e tests/test_litellm/proxy holds

Coverage guard catches a new directory

A throwaway tests/unit/proxy/zz_new_dir/{__init__,test_x}.py added locally at the head, then removed (never committed)

$ python3 .github/scripts/assert_ci_coverage.py --shards
ERROR: test directories and files that no shard claims
  - tests/unit/proxy/zz_new_dir: holds tests but no shard of tests/unit/proxy names it

Add each to the shard it belongs to. A directory that is itself split across several shards belongs in SHARDED_ROOTS instead, so its own children get checked.

exit=1

With the throwaway removed, it prints OK: all 161 test children across 2 sharded trees are assigned to a shard. and exits 0. A throwaway root file tests/unit/proxy/test_zz_new_root.py is picked up by the proxy-infra-root glob without any edit

unit_selection.sh is now parsed per case arm. _shard_tokens credits an arm's paths only when its label is the value of some unit-flag: in a workflow, so a path claimed only by an unwired flag is reported as unassigned. test_shard_tokens_credits_only_wired_unit_flags builds a tree where one arm is wired and one isn't, and asserts the unwired child is flagged. Crediting every arm turns it red:

E       AssertionError: assert () == ('tests/tree/unwired',)
FAILED tests/unit/test_assert_ci_coverage.py::test_shard_tokens_credits_only_wired_unit_flags

The union of all arms that the default census uses is the same token set as before

Pointing SHARDED_ROOTS at tests/unit/proxy surfaced two directories that only the CircleCI unit catch-all ran. tests/unit/proxy/management (from #43364, before this stack) now joins proxy-infra through unit_selection.sh and runs 36 passed with sockets blocked and zero egress. No other flag or workflow selects it. tests/unit/proxy/response_polling was named only file by file in its proxy-db group, so that entry now names the directory (same group, same selection)

Root-file glob and the proxy-infra split

The 81 root files moved from proxy-infra into a new proxy-infra-root shard (same workers, reruns and timeouts, no unit-flag), and make test-unit-proxy-root mirrors it. test_streaming_handler.py's event-loop-lag asserts failed twice in proxy-infra on 820e63c. On that worker they shared time with heavy synchronous root files such as test_health_check_max_tokens.py. Splitting fixes that without touching the assert. Collect-only: proxy-infra 5027 ids plus proxy-infra-root 3218 ids gives 8245, identical to the pre-split proxy-infra selection with 0 overlap. The root glob plus 25 --ignore= selects the same 81 files as PR 6's explicit list

Redirect test

respx serves two routes. https://upstream.test/redirect/1 returns 302 with Location: /get, and /get returns 200 JSON. httpx_transport keeps the call on httpx. The test asserts a 200, the /get body and the recorded call URLs in order. It passes 20 of 20 in a row. Flipping the follow_redirects default to False in litellm/llms/custom_httpx/http_handler.py turns it red, reverted afterwards

E       AssertionError: RESPX: some routes were not called!
E         Left contains one more item: <Route <Scheme eq 'https'> AND <Host eq 'upstream.test'> AND <Path eq '/get'> AND <Method eq 'GET'>>
FAILED tests/unit/proxy/pass_through_endpoints/test_pass_through_endpoints.py::test_pass_through_request_follows_redirect_to_final_response

test_check_shards_passes_on_the_repo_as_it_stands calls _check_shards() directly and goes red when | _unit_selection_tokens() is dropped from it

Runs

tests/unit/proxy/pass_through_endpoints with env -i, outbound sockets blocked and the egress recorder, -n 4 --timeout=120: 1579 passed. tests/unit/proxy/management under the same settings: 36 passed, no egress. tests/unit/test_package_layout.py and tests/unit/test_assert_ci_coverage.py pass, and assert_ci_coverage.py prints OK in default, --shards and --slices modes. Ruff is clean on the edited files. git grep "test_litellm/proxy\|test_litellm\.proxy" returns only the two lines in litellm/proxy/_experimental/mcp_server/ that this stack does not touch

Non-rename edits

file +/- reason
pass_through_endpoints/test_pass_through_endpoints.py 20/23 respx redirect test in place of the httpbin one
.github/workflows/test-unit.yml 34/82 legacy pass-through path dropped, explicit root list replaced by the glob plus ignores in the new proxy-infra-root shard
Makefile 6/83 same glob and ignores in a new test-unit-proxy-root target, PROXY_INFRA_ROOT_TESTS removed
.github/scripts/assert_ci_coverage.py 43/5 SHARDED_ROOTS entry, and --shards credits unit_selection.sh arms only for GHA-wired flags
.circleci/scripts/unit_selection.sh 2/1 tests/unit/proxy/management under proxy-infra, response_polling named as a directory
tests/unit/test_assert_ci_coverage.py 36/2 synthetic nested path no longer uses the legacy tree, repo-state test uses _shard_tokens, new _check_shards and unwired-flag tests
tests/test_ratelimit.py 1/1 skip reason points at tests/unit/proxy/hooks/test_parallel_request_limiter.py, since test_router_rate_limit.py no longer exists
tests/e2e/batches/COVERAGE.md, utils/prisma_and_spend/conftest.py, utils/proxy_logging/conftest.py 1/1 each path strings
tests/test_litellm/proxy/conftest.py, __init__.py 0/285 legacy package removed. Every fixture it held was ported to tests/unit/proxy/conftest.py earlier in the stack, and no file imports it

Type

✅ Test

Caveats (if any)

Low

  • test_pass_throughs_stay_open_while_a_db_sync_reads_the_database tries langfuse.example.test:443
    • The egress recorder logs two blocked attempts. One also lands on the xdist neighbour test_passthrough_keeps_each_registered_litellm_owned_name_out_of_the_forwarded_body[no-log], a pure function test, so it looks like a leaked background send
    • Reserved .test name, blocked in unit CI, and both tests pass either way
    • Same behavior as before the move. Left as is since it is a pure rename here

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

@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!

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Reorganizes test structure and CI test selection logic.

The PR appears safe to merge based on the reviewed changes.

Summary

This PR removes the legacy proxy test tree, moves the remaining pass-through test, replaces its live redirect request with an in-process test, and reorganizes proxy test shards and their coverage check.

  • The change since the previous review corrects the rate-limit skip reference.

Reviews (4) · Last reviewed commit: "test(proxy): point the rate-limit skip r..."

Comment thread tests/unit/proxy/pass_through_endpoints/test_pass_through_endpoints.py Outdated
Comment thread .github/scripts/assert_ci_coverage.py Outdated
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai review

@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_p7 branch from 8864d36 to c829e8b Compare October 1, 2026 14:13
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai review (rebased onto the updated PR 6)

Comment thread tests/test_ratelimit.py Outdated
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai review

@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
@devin-ai-integration
devin-ai-integration Bot force-pushed the litellm_migrate_proxy_tests_p7 branch from dab7efa to 633713c Compare October 1, 2026 16:40
@yuneng-berri
yuneng-berri force-pushed the litellm_migrate_proxy_tests_p6 branch from 8c84336 to c7bbab0 Compare October 1, 2026 17:53
@yuneng-berri
yuneng-berri force-pushed the litellm_migrate_proxy_tests_p7 branch from 633713c to 25ef8d3 Compare October 1, 2026 17:53
@yuneng-berri
yuneng-berri force-pushed the litellm_migrate_proxy_tests_p6 branch from c7bbab0 to a03f35e Compare October 1, 2026 18:07
@yuneng-berri
yuneng-berri force-pushed the litellm_migrate_proxy_tests_p7 branch from 25ef8d3 to 8d04963 Compare October 1, 2026 18:07
@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 force-pushed the litellm_migrate_proxy_tests_p7 branch from 8d04963 to 7ac7dab Compare October 1, 2026 18:15
Base automatically changed from litellm_migrate_proxy_tests_p6 to main October 1, 2026 18:23
@devin-ai-integration
devin-ai-integration Bot requested a review from a team October 1, 2026 18:23
yuneng-berri and others added 7 commits October 1, 2026 11:24
… test from loopback

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ed children

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ing-v2 RPM tests

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_p7 branch from 7ac7dab to c4867bc Compare October 1, 2026 18:24
@yuneng-berri
yuneng-berri merged commit 2cfa5ec into main Oct 1, 2026
101 of 103 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_migrate_proxy_tests_p7 branch October 1, 2026 18:40
yuneng-berri added a commit that referenced this pull request Oct 1, 2026
…4055)

* docs(proxy): point mcp_server test references at tests/unit/proxy

The legacy tests/test_litellm/proxy tree was removed in #44018. Repoint the
mcp_server AGENTS.md mirror path, swap its auth example for a module that still
exists, and drop the utils.py comment block that named the old test path

* docs(proxy): fix remaining mcp_server legacy test path and note import-time env reads

Repoint the second tests/test_litellm reference in the mcp_server AGENTS.md
Tests section and move the import-time env guidance there from the removed
utils.py comment
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