From b00a7b050a1102a7f60db8f77c4b4a285166fcf7 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 5 May 2026 13:34:19 +0800 Subject: [PATCH] test(ollama): align inference connect errors with degraded health --- apps/api/tests/test_ollama_health_monitor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/api/tests/test_ollama_health_monitor.py b/apps/api/tests/test_ollama_health_monitor.py index 4949688e..d67231cf 100644 --- a/apps/api/tests/test_ollama_health_monitor.py +++ b/apps/api/tests/test_ollama_health_monitor.py @@ -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):