Run immediate health probe after jail deactivation
After deactivation the endpoint now calls _run_probe to flush the cached server status immediately, matching the activate_jail behaviour added in Task 5. Without this, the dashboard active-jail count could remain stale for up to 30 s after a deactivation reload. - config.py: capture result, await _run_probe, return result - test_config.py: add test_deactivate_triggers_health_probe; fix 3 pre-existing UP017 ruff warnings (datetime.UTC alias) - test_health.py: update test to assert the new fail2ban field
This commit is contained in:
@@ -13,10 +13,11 @@ async def test_health_check_returns_200(client: AsyncClient) -> None:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_health_check_returns_ok_status(client: AsyncClient) -> None:
|
||||
"""``GET /api/health`` must return ``{"status": "ok"}``."""
|
||||
"""``GET /api/health`` must contain ``status: ok`` and a ``fail2ban`` field."""
|
||||
response = await client.get("/api/health")
|
||||
data: dict[str, str] = response.json()
|
||||
assert data == {"status": "ok"}
|
||||
assert data["status"] == "ok"
|
||||
assert data["fail2ban"] in ("online", "offline")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user