This commit is contained in:
@@ -32,7 +32,29 @@ def test_collect_ai_automation_smoke_uses_worst_status(monkeypatch):
|
||||
monkeypatch.setattr(smoke, "_embedding_queue_check", lambda: smoke._check("embedding", "critical", "boom"))
|
||||
monkeypatch.setattr(smoke, "_elephant_hitl_check", lambda: smoke._check("elephant", "ok", "ok"))
|
||||
|
||||
result = smoke.collect_ai_automation_smoke()
|
||||
result = smoke.collect_ai_automation_smoke(record_history=False)
|
||||
|
||||
assert result["status"] == "critical"
|
||||
assert result["summary"] == {"ok": 3, "warning": 1, "critical": 1, "total": 5}
|
||||
|
||||
|
||||
def test_collect_ai_automation_smoke_persists_recent_history(tmp_path, monkeypatch):
|
||||
from services import ai_automation_smoke_service as smoke
|
||||
|
||||
history_path = tmp_path / "smoke_history.jsonl"
|
||||
monkeypatch.setattr(smoke, "_HISTORY_PATH", str(history_path))
|
||||
monkeypatch.setattr(smoke, "_HISTORY_LIMIT", 2)
|
||||
monkeypatch.setattr(smoke, "_event_router_check", lambda: smoke._check("event", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_autoheal_check", lambda: smoke._check("autoheal", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_nemotron_check", lambda: smoke._check("nemotron", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_embedding_queue_check", lambda: smoke._check("embedding", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_elephant_hitl_check", lambda: smoke._check("elephant", "ok", "ok"))
|
||||
|
||||
first = smoke.collect_ai_automation_smoke(history_limit=5)
|
||||
second = smoke.collect_ai_automation_smoke(history_limit=5)
|
||||
third = smoke.collect_ai_automation_smoke(history_limit=5)
|
||||
|
||||
assert first["status"] == "ok"
|
||||
assert second["history"]["counts"]["ok"] == 2
|
||||
assert third["history"]["counts"]["ok"] == 2
|
||||
assert len(history_path.read_text(encoding="utf-8").strip().splitlines()) == 2
|
||||
|
||||
Reference in New Issue
Block a user