feat: comprehensive health check with DB, scheduler, cache
- Add /api/v1/health endpoint with component-level checks - Verify DB connectivity, fail2ban socket, scheduler, session cache - Add SQLite WAL cleanup on startup (orphan crash files) - Migration 8: import_log.timestamp → INTEGER UNIX epoch - Align import_log timestamps with history_archive (already UNIX int) - Add unit tests for DB cleanup and health router Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -62,12 +62,19 @@ async def client(test_settings: Settings) -> AsyncClient: # type: ignore[misc]
|
||||
Yields:
|
||||
An :class:`httpx.AsyncClient` with ``base_url="http://test"``.
|
||||
"""
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
app = create_app(settings=test_settings)
|
||||
|
||||
# Ensure fail2ban is reported as online for tests (mock socket is not
|
||||
# actually connected so we need to set the cached status manually).
|
||||
app.state.server_status = ServerStatus(online=True)
|
||||
|
||||
# Mock scheduler for health check tests (lifespan not run in ASGITransport tests)
|
||||
mock_scheduler = MagicMock()
|
||||
mock_scheduler.running = True
|
||||
app.state.scheduler = mock_scheduler
|
||||
|
||||
# Bootstrap the database schema before making requests. ASGITransport
|
||||
# does not run the application lifespan, so we create the test SQLite file
|
||||
# directly rather than relying on startup logic.
|
||||
|
||||
Reference in New Issue
Block a user