Skip to content

[Test] Proxy E2E: Opt In To Client Mock Response For Model Access Tests - #26941

Merged
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_/stoic-jemison-cbb6cf
May 1, 2026
Merged

[Test] Proxy E2E: Opt In To Client Mock Response For Model Access Tests#26941
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_/stoic-jemison-cbb6cf

Conversation

@yuneng-berri

Copy link
Copy Markdown
Contributor

Summary

  • The proxy's ingress hardening (842eea0131) added mock_response / mock_tool_calls to _UNTRUSTED_ROOT_CONTROL_FIELDS in litellm/proxy/litellm_pre_call_utils.py — they are now stripped from client requests unless the calling key or team has admin-metadata allow_client_mock_response: true.
  • tests/otel_tests/test_e2e_model_access.py relies on mock_response (passed in extra_body) to short-circuit completions. Without the flag the request actually runs; the bedrock/* route in otel_test_config.yaml points at a shared fake endpoint that 404s on unsupported bedrock paths, so test_model_access_patterns[key_models2-bedrock/anthropic.claude-3-True] started failing in CI.
  • Fix: set allow_client_mock_response: true on every key and team this test creates. No production code changes.

Failing job: https://app.circleci.com/pipelines/github/BerriAI/litellm/75860/workflows/b6853c9c-8b58-4036-a6b3-43e1d3616c9c/jobs/1589284/tests#failed-test-0

Test plan

  • CI proxy_logging_guardrails_model_info_tests passes (it runs tests/otel_tests against the proxy with otel_test_config.yaml)
  • No regression in the gpt-4 / openai-only parametrize rows (those previously passed via real OpenAI)

The proxy's ingress hardening (commit 842eea0) now strips client-supplied
`mock_response` from the request body unless the calling key or team has the
`allow_client_mock_response: true` admin-metadata flag set. The e2e model
access tests rely on `mock_response` to short-circuit the LLM call, so without
the flag they hit real backends — the bedrock wildcard route fakes out to a
shared example endpoint that now 404s on unsupported paths, causing
`test_model_access_patterns[key_models2-bedrock/anthropic.claude-3-True]`
(and the bedrock/anthropic.* row that pytest -x never reaches) to fail.

Set `allow_client_mock_response: true` on every key and team this test file
provisions so `mock_response` is preserved end-to-end.
@greptile-apps

greptile-apps Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adapts tests/otel_tests/test_e2e_model_access.py to the proxy's ingress-hardening change that added mock_response/mock_tool_calls to _UNTRUSTED_ROOT_CONTROL_FIELDS. Every key and team created by the test now carries {"allow_client_mock_response": True} in its metadata, matching the opt-in pattern used in other test suites (test_litellm_pre_call_utils.py, test_proxy_server.py). No production code is touched and no test assertions are weakened — the fix restores the intended mock-response short-circuit rather than bypassing any checks.

Confidence Score: 5/5

Safe to merge — test-only change that correctly opts in to the existing admin-metadata flag without weakening any assertions.

The change is minimal and well-scoped: it propagates the allow_client_mock_response opt-in to all key/team creation sites in the test file, consistent with the pattern used in the rest of the test suite. No production logic is modified, no assertions are relaxed, and the underlying flag mechanism (_key_or_team_metadata_flag_is_true) already has its own unit tests.

No files require special attention.

Important Files Changed

Filename Overview
tests/otel_tests/test_e2e_model_access.py Adds allow_client_mock_response: true metadata to all key/team creation calls so the proxy's ingress hardening doesn't strip mock_response from test requests; no logic changes to assertions or access-control checks.

Reviews (1): Last reviewed commit: "[Test] Proxy E2E: Opt In To Client Mock ..." | Re-trigger Greptile

@yuneng-berri
yuneng-berri merged commit 326bcd6 into litellm_internal_staging May 1, 2026
98 of 116 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_/stoic-jemison-cbb6cf branch May 1, 2026 00:35
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…cbb6cf

[Test] Proxy E2E: Opt In To Client Mock Response For Model Access Tests
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