fix: reject unconfigured s3 health checks

This commit is contained in:
Genmin 2026-05-01 07:31:17 -07:00
parent cdc630c4f8
commit c110f5a2aa
2 changed files with 18 additions and 0 deletions

View file

@ -240,6 +240,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

@ -3,6 +3,7 @@ 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
@ -15,3 +16,13 @@ async def test_health_services_endpoint_accepts_s3_callback():
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)