fix(tests): update MCP server test mocks to match production API - #22198
Merged
Conversation
The tests were mocking `filter_server_ids_by_ip` but the production code in server.py now calls `filter_server_ids_by_ip_with_info` which returns a (server_ids, blocked_count) tuple. Update all 8 mock sites to use the correct method name and return signature. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThis PR fixes 8 failing MCP server tests by updating mock method names and return values to match the current production API. The production code (
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.py | Updated 8 mock sites from filter_server_ids_by_ip to filter_server_ids_by_ip_with_info with correct (server_ids, 0) tuple return, matching the production API in server.py and rest_endpoints.py. |
Sequence Diagram
sequenceDiagram
participant Test as Test Mock
participant Manager as MCPServerManager
participant Server as server.py / rest_endpoints.py
Note over Server: Production code calls<br/>filter_server_ids_by_ip_with_info()
Server->>Manager: filter_server_ids_by_ip_with_info(server_ids, client_ip)
Manager-->>Server: (filtered_ids, blocked_count)
Note over Test: Before fix (old mock)
Test->>Manager: filter_server_ids_by_ip(server_ids, client_ip)
Manager-->>Test: server_ids (list only)
Note over Test: ❌ AttributeError — method not found
Note over Test: After fix (new mock)
Test->>Manager: filter_server_ids_by_ip_with_info(server_ids, client_ip)
Manager-->>Test: (server_ids, 0) (tuple)
Note over Test: ✅ Tests pass
Last reviewed commit: ace49b1
fzowl
pushed a commit
to fzowl/litellm
that referenced
this pull request
Jun 24, 2026
…k-mismatch fix(tests): update MCP server test mocks to match production API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
filter_server_ids_by_ip(old API) butserver.pynow callsfilter_server_ids_by_ip_with_infowhich returns a(server_ids, blocked_count)tuple(server_ids, 0)Failing tests fixed
test_get_tools_from_mcp_servers_continues_when_one_server_failstest_get_tools_from_mcp_servers_handles_all_servers_failingtest_list_tools_filters_by_key_team_permissionstest_list_tools_multiple_servers_prefixed_namestest_list_tools_single_server_unprefixed_namestest_list_tools_strips_prefix_when_matching_permissionstest_list_tools_with_no_tool_permissions_shows_alltest_list_tools_with_team_tool_permissions_inheritanceTest plan
🤖 Generated with Claude Code