This commit is contained in:
Joey Roth 2026-06-01 11:24:53 -05:00 • committed by GitHub
commit 7c8ebc4f48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 0 deletions

View file

@ -127,6 +127,7 @@ services = Union[
"datadog_llm_observability",
"generic_api",
"arize",
"s3",
"sqs",
],
str,
@ -204,6 +205,7 @@ async def health_services_endpoint( # noqa: PLR0915
"datadog_llm_observability",
"generic_api",
"arize",
"s3",
"sqs",
]:
raise HTTPException(
@ -242,6 +244,13 @@ async def health_services_endpoint( # noqa: PLR0915
"status": "success",
"message": "Mock LLM request made - check {}.".format(service),
}
elif service == "s3":
raise HTTPException(
status_code=422,
detail={
"error": '"s3" not in proxy config: litellm_settings.success_callback. Unable to test this.'
},
)
elif service == "datadog":
from litellm.integrations.datadog.datadog import DataDogLogger

View file

@ -0,0 +1,28 @@
from unittest.mock import AsyncMock, patch
import pytest
from litellm.proxy.health_endpoints._health_endpoints import health_services_endpoint
from litellm.proxy._types import ProxyException
@pytest.mark.asyncio
async def test_health_services_endpoint_accepts_s3_callback():
with (
patch("litellm.success_callback", ["s3"]),
patch("litellm.acompletion", new=AsyncMock(return_value={})),
):
result = await health_services_endpoint(service="s3")
assert result["status"] == "success"
assert "s3" in result["message"]
@pytest.mark.asyncio
async def test_health_services_endpoint_rejects_unconfigured_s3_callback():
with patch("litellm.success_callback", []):
with pytest.raises(ProxyException) as exc_info:
await health_services_endpoint(service="s3")
assert exc_info.value.code == "422"
assert "litellm_settings.success_callback" in str(exc_info.value.message)