test(ollama): align inference connect errors with degraded health
Some checks failed
CD Pipeline / tests (push) Failing after 2m26s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
Code Review / ai-code-review (push) Successful in 28s

This commit is contained in:
Your Name
2026-05-05 13:34:19 +08:00
parent 506744ba3a
commit b00a7b050a

View File

@@ -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):