Minor updates

This commit is contained in:
2026-08-25 07:11:22 +02:00
parent 50c64e0541
commit bd0abab759
5 changed files with 173 additions and 8 deletions
+14 -2
View File
@@ -44,8 +44,9 @@ class LLMServiceTests(unittest.IsolatedAsyncioTestCase):
)
transport = httpx.ASGITransport(app=module.app)
async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
response = await client.get("/health")
with self.assertLogs("llm", level="INFO") as captured:
async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as client:
response = await client.get("/health")
self.assertEqual(response.status_code, 200)
self.assertEqual(
@@ -59,6 +60,17 @@ class LLMServiceTests(unittest.IsolatedAsyncioTestCase):
"gpu_layers": 0,
},
)
joined_logs = "\n".join(captured.output)
self.assertIn("incoming_request service=llm", joined_logs)
self.assertIn("completed_request service=llm", joined_logs)
self.assertIn("caller=127.0.0.1", joined_logs)
self.assertIn("method=GET", joined_logs)
self.assertIn("path=/health", joined_logs)
self.assertIn("status_code=200", joined_logs)
self.assertIn("response_time_ms=", joined_logs)
self.assertIn("cpu_time_ms=", joined_logs)
self.assertIn("cpu_percent=", joined_logs)
self.assertIn("rss_mb=", joined_logs)
async def test_health_reports_unavailable_when_process_is_down(self):
module = load_llm_module()