mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix: stabilize 5 CI test failures
- Vertex AI batch cost tests: replace removed gemini-1.5-flash-001 model with gemini-2.0-flash-001 in pricing lookups - MCP test_executes_tool_when_allowed: add server_id and auth_type attrs to StubServer to match new _resolve_allowed_mcp_servers_with_ip_filter - MCP M2M tests: infer oauth2_flow='client_credentials' in _execute_with_mcp_client when client_id/client_secret/token_url present (NewMCPServerRequest lacks oauth2_flow field) - Team list test: update mock find_many to filter by team_id per the current per-team query pattern in list_team - Azure DALL-E 3 health check: skip test due to 410 ModelDeprecated Co-authored-by: yuneng-jiang <yuneng-jiang@users.noreply.github.com>
This commit is contained in:
parent
9a356644bf
commit
177edb06ae
5 changed files with 26 additions and 6 deletions
|
|
@ -905,6 +905,12 @@ if MCP_AVAILABLE:
|
|||
try:
|
||||
client_id, client_secret, scopes = _extract_credentials(request)
|
||||
|
||||
_oauth2_flow = (
|
||||
"client_credentials"
|
||||
if client_id and client_secret and request.token_url
|
||||
else None
|
||||
)
|
||||
|
||||
server_model = MCPServer(
|
||||
server_id=request.server_id or "",
|
||||
name=request.alias or request.server_name or "",
|
||||
|
|
@ -922,6 +928,7 @@ if MCP_AVAILABLE:
|
|||
scopes=scopes,
|
||||
authorization_url=request.authorization_url,
|
||||
registration_url=request.registration_url,
|
||||
oauth2_flow=_oauth2_flow,
|
||||
)
|
||||
|
||||
stdio_env = global_mcp_server_manager._build_stdio_env(
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ async def test_openai_img_gen_health_check():
|
|||
# asyncio.run(test_openai_img_gen_health_check())
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Azure DALL-E 3 model deployment is deprecated (410 ModelDeprecated)")
|
||||
@pytest.mark.asyncio
|
||||
async def test_azure_img_gen_health_check():
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -759,12 +759,14 @@ class TestCallToolRestAPI:
|
|||
return ["server-1"]
|
||||
|
||||
class StubServer:
|
||||
server_id = "server-1"
|
||||
alias = "server-1"
|
||||
server_name = "server-1"
|
||||
name = "stub"
|
||||
allowed_tools = None
|
||||
mcp_info = {"server_name": "stub"}
|
||||
available_on_public_internet = True
|
||||
auth_type = None
|
||||
|
||||
stub_server = StubServer()
|
||||
|
||||
|
|
|
|||
|
|
@ -6142,8 +6142,18 @@ async def test_list_team_v1_batches_key_queries():
|
|||
new_callable=AsyncMock,
|
||||
return_value=[],
|
||||
):
|
||||
mock_find_many = AsyncMock(return_value=[key1, key2, key3])
|
||||
mock_prisma_client.db.litellm_verificationtoken.find_many = mock_find_many
|
||||
async def filtered_find_many(**kwargs):
|
||||
where = kwargs.get("where", {})
|
||||
tid = where.get("team_id")
|
||||
if tid == "team-1":
|
||||
return [key1, key2]
|
||||
elif tid == "team-2":
|
||||
return [key3]
|
||||
return [key1, key2, key3]
|
||||
|
||||
mock_prisma_client.db.litellm_verificationtoken.find_many = AsyncMock(
|
||||
side_effect=filtered_find_many
|
||||
)
|
||||
|
||||
result = await list_team(
|
||||
http_request=mock_request,
|
||||
|
|
|
|||
|
|
@ -395,7 +395,7 @@ class TestVertexAIBatchCostCalculation:
|
|||
]
|
||||
|
||||
total_cost, usage = calculate_vertex_ai_batch_cost_and_usage(
|
||||
responses, model_name="gemini-1.5-flash-001"
|
||||
responses, model_name="gemini-2.0-flash-001"
|
||||
)
|
||||
|
||||
assert usage.prompt_tokens == 18
|
||||
|
|
@ -430,7 +430,7 @@ class TestVertexAIBatchCostCalculation:
|
|||
]
|
||||
|
||||
total_cost, usage = calculate_vertex_ai_batch_cost_and_usage(
|
||||
responses, model_name="gemini-1.5-flash-001"
|
||||
responses, model_name="gemini-2.0-flash-001"
|
||||
)
|
||||
|
||||
assert usage.prompt_tokens == 18
|
||||
|
|
@ -443,7 +443,7 @@ class TestVertexAIBatchCostCalculation:
|
|||
from litellm.batches.batch_utils import calculate_vertex_ai_batch_cost_and_usage
|
||||
|
||||
total_cost, usage = calculate_vertex_ai_batch_cost_and_usage(
|
||||
[], model_name="gemini-1.5-flash-001"
|
||||
[], model_name="gemini-2.0-flash-001"
|
||||
)
|
||||
|
||||
assert total_cost == 0.0
|
||||
|
|
@ -460,7 +460,7 @@ class TestVertexAIBatchCostCalculation:
|
|||
]
|
||||
|
||||
total_cost, usage = calculate_vertex_ai_batch_cost_and_usage(
|
||||
responses, model_name="gemini-1.5-flash-001"
|
||||
responses, model_name="gemini-2.0-flash-001"
|
||||
)
|
||||
|
||||
assert usage.prompt_tokens == 0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue