test(e2e): rename Gateway to ProxyClient and expose it as a session-scoped pytest fixture - #33750
Conversation
|
|
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Greptile SummaryThis PR renames the shared e2e harness object (
Confidence Score: 5/5Safe to merge — purely a rename refactor of test infrastructure with no production code touched. The change is a mechanical, exhaustive rename across 56 test-only files. No logic changes occur anywhere: the same SplitTransport, poll budget, and resource-cleanup paths are wired together identically, just through the injected proxy fixture rather than per-suite construction. The previous variable-shadowing concern in claude_code/conftest.py is resolved (proxy_config now holds the ProxyConfig, proxy holds the ProxyClient). A grep confirms no stale e2e_gateway/build_gateway/.gateway references remain in the tree. No files require special attention.
|
| Filename | Overview |
|---|---|
| tests/e2e/proxy_client.py | Renamed from e2e_gateway.py; class renamed Gateway → ProxyClient, build_gateway → build_proxy_client. No logic changes. |
| tests/e2e/conftest.py | Adds the new session-scoped proxy fixture and updates the resources fixture to use ProxyClientProvider / .proxy. |
| tests/e2e/claude_code/conftest.py | Resolves previous variable-shadowing: ProxyConfig now stored in proxy_config, ProxyClient in proxy. Helper renamed _build_control_gateway → _build_control_plane_client. |
| tests/e2e/lifecycle.py | GatewayProvider protocol renamed to ProxyClientProvider; .gateway property renamed to .proxy. No behavioral change. |
| tests/e2e/router/conftest.py | All Gateway references updated to ProxyClient; client fixture now injects the session-scoped proxy. |
| tests/e2e/quota_management/budgets/budget_client.py | Mechanical rename of .gateway → .proxy throughout; build_client now accepts ProxyClient instead of constructing its own. |
| tests/e2e/logging/logging_client.py | All gateway references updated to proxy; build_logging_client now takes a ProxyClient argument. |
| tests/e2e/management/management_client.py | Mechanical rename; build_client now accepts ProxyClient instead of calling build_gateway internally. |
| tests/e2e/mcp/mcp_client.py | New suite (added during staging) fully updated to use ProxyClient/.proxy pattern matching the rest of the harness. |
Reviews (3): Last reviewed commit: "test(e2e): rename Gateway to ProxyClient..." | Re-trigger Greptile
fb57ccc to
37b8aac
Compare
|
@greptileai please review the current head 37b8aac Addressed the P2 shadowing finding in |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…coped fixture The shared proxy wrapper in tests/e2e/e2e_gateway.py was misnamed: Gateway is not a gateway server, it is the client every suite uses to talk to the proxy (keys, models, chat/embed/ocr, spend read-backs, poll helpers). Rename the module to proxy_client.py and the class to ProxyClient, with build_gateway becoming build_proxy_client and the GatewayProvider protocol becoming ProxyClientProvider. The .gateway attribute suites held is now .proxy. Only identifiers changed; prose and string literals that use the word gateway for the proxy-server concept were left alone. Each suite previously built its own instance through a per-suite build_client() that called build_gateway() inside, duplicating the proxy wiring across suites. There is now one session-scoped proxy fixture in tests/e2e/conftest.py; every suite's client fixture depends on it and injects it, so the wiring lives in one place. claude_code keeps building its own client directly since it has its own harness and does not use the shared fixtures. Behavior is unchanged: shared transport, data-plane/control-plane split routing, poll budget, typed request/response models, and resource cleanup all go through the same object.
8c07d6f to
c81c4a3
Compare
|
@greptileai please review the current head c81c4a3 Rebased onto current litellm_internal_staging to resolve the merge conflict; squashed to a single commit. The rebase surfaced new e2e suites that landed on staging while this PR was open (the mcp suite, a team-member budget isolation test, and new budget_client readback methods) that still referenced the old |
Relevant issues
Linear ticket
Resolves LIT-4549
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Type
🧹 Refactoring
✅ Test
Changes
Two changes to the e2e harness; no product code is touched.
Rename the misnamed shared proxy wrapper.
tests/e2e/e2e_gateway.pyheldGateway, which is not a gateway server; it is the client every suite uses to talk to the proxy (keys, models, chat/embed/ocr, spend read-backs, poll helpers). The file is nowproxy_client.pyand the class isProxyClient, withbuild_gatewaybecomingbuild_proxy_clientand theGatewayProviderprotocol becomingProxyClientProvider. The.gatewayattribute suites held is now.proxy. Only identifiers changed; the git rename is recorded as a rename so history is preserved. Prose and string literals that use the word gateway for the proxy-server concept were left alone, and the docstrings/comments plus the e2eCLAUDE.md/CONTRIBUTING.mdcode examples were updated to match.Make it a pytest fixture. Previously each suite built its own instance through a per-suite
build_client()that calledbuild_gateway()inside, so the proxy wiring was duplicated across every suite. There is now one session-scopedproxyfixture intests/e2e/conftest.py:Each suite's
clientfixture depends on it and injects it, and each suite factory takes the client instead of constructing its own:Behavior is unchanged: shared transport, data-plane/control-plane split routing, poll budget, typed request/response models, and resource cleanup all go through the same object.
claude_code/keeps callingbuild_proxy_client(...)directly with its own base URLs since it has its own harness and does not use the shared fixtures.Screenshots / Proof of Fix
This is a rename plus fixture-wiring refactor of the test harness, so there is no product behavior to demonstrate with an LLM call; what has to hold is that the harness still imports, collects, type-checks, and resolves its coverage markers exactly as before. Captured at commit
37b8aac260ruff check tests/e2emake lint-e2e-basedpyright(the CI gate; zero errors allowed)pytest tests/e2e --collect-only(every suite's client fixture resolves against the new session-scopedproxyfixture; no import or fixture error)python -m coverage_registry.collector(everycovers(...)marker still resolves after the rename; nothing regressed)QA runbook
No e2e test's assertions changed; this PR renames the shared harness object and moves its construction into a single session-scoped fixture, so there are no new per-test manual steps to reproduce. The behavior-preservation checks a reviewer can rerun are the four above:
ruff check tests/e2e,make lint-e2e-basedpyright,pytest tests/e2e --collect-only, andpython -m coverage_registry.collectorfromtests/e2eFinal Attestation