Complete operational monitoring summary
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from govoplan_core.core.operations import (
|
||||
OperationalCheck,
|
||||
@@ -124,3 +125,34 @@ def test_database_capacity_check_enforces_shared_rendered_budget(
|
||||
overrun = routes._database_capacity_check()
|
||||
assert overrun["state"] == "error"
|
||||
assert overrun["readiness_critical"] is True
|
||||
|
||||
|
||||
def test_recovery_metrics_separate_failure_unknown_and_active_work() -> None:
|
||||
metrics = routes._recovery_metrics(
|
||||
[
|
||||
{"status": "running"},
|
||||
{"status": "failed"},
|
||||
{"status": "outcome_unknown"},
|
||||
{"status": "recovery_required"},
|
||||
{"status": "manual_intervention"},
|
||||
]
|
||||
)
|
||||
|
||||
assert metrics == {
|
||||
"failed": 2,
|
||||
"outcome_unknown": 1,
|
||||
"recovery_required": 1,
|
||||
"active": 1,
|
||||
"requires_attention": 4,
|
||||
}
|
||||
|
||||
|
||||
def test_local_storage_capacity_reports_bounded_filesystem_metrics(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
metrics = routes._local_storage_capacity(tmp_path)
|
||||
|
||||
assert metrics["backend"] == "local"
|
||||
assert metrics["capacity_observable"] is True
|
||||
assert metrics["capacity_total_bytes"] > 0
|
||||
assert 0 <= metrics["capacity_used_percent"] <= 100
|
||||
|
||||
Reference in New Issue
Block a user