diff --git a/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py b/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py index 67008ea2ffb..fbb5aeabf2d 100644 --- a/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py +++ b/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py @@ -4186,11 +4186,15 @@ async def test_health_services_endpoint_langfuse_missing_keys_errors(monkeypatch """v2 raised out of ``auth_check`` and the endpoint printed the server's answer; the v4 check returns the failure as a value, and the endpoint has to error with that reason rather than a generic credentials message that reads the same for an outage and a bad key.""" - for key in ("LANGFUSE_PUBLIC_KEY", "LANGFUSE_SECRET_KEY", "LANGFUSE_BASE_URL", "LANGFUSE_MOCK"): - monkeypatch.delenv(key, raising=False) - monkeypatch.setenv("LANGFUSE_HOST", "http://127.0.0.1:9") - monkeypatch.setattr(litellm, "initialized_langfuse_clients", litellm.initialized_langfuse_clients) + import litellm.integrations.langfuse.langfuse as langfuse_module + from litellm.integrations.langfuse.langfuse_sdk import AuthCheckFailure + + logger_class = MagicMock() + logger_class.return_value.api_client.auth_check.return_value = AuthCheckFailure( + "connection refused by lf.internal.example" + ) + monkeypatch.setattr(langfuse_module, "LangFuseLogger", logger_class) with pytest.raises(ProxyException, match="auth_check failed") as raised: await health_services_endpoint(service="langfuse") - assert "127.0.0.1" in str(raised.value.message) or "refused" in str(raised.value.message).lower() + assert "connection refused by lf.internal.example" in str(raised.value.message)