test(ollama): align inference connect errors with degraded health
This commit is contained in:
@@ -243,8 +243,8 @@ class TestInference:
|
||||
assert report.status == HealthStatus.DEGRADED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_inference_connect_error_offline(self, monitor):
|
||||
"""推理 ConnectError → OFFLINE(連通性層已放行,但推理層掉線)"""
|
||||
async def test_inference_connect_error_degraded(self, monitor):
|
||||
"""推理 ConnectError → DEGRADED(連通性已通過,視為 socket 瞬斷)"""
|
||||
mock_client = AsyncMock()
|
||||
mock_client.post = AsyncMock(side_effect=httpx.ConnectError("refused"))
|
||||
mock_client.__aenter__ = AsyncMock(return_value=mock_client)
|
||||
@@ -253,7 +253,7 @@ class TestInference:
|
||||
with patch("httpx.AsyncClient", return_value=mock_client):
|
||||
report = await monitor._check_inference(HOST)
|
||||
|
||||
assert report.status == HealthStatus.OFFLINE
|
||||
assert report.status == HealthStatus.DEGRADED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_inference_non_200_degraded(self, monitor):
|
||||
|
||||
Reference in New Issue
Block a user