feat: add backup alert generation engine
This commit is contained in:
@@ -55,3 +55,20 @@ def test_create_job_and_run():
|
||||
})
|
||||
assert run["job_id"] == job["id"]
|
||||
assert run["status"] == "success"
|
||||
|
||||
|
||||
def test_alert_failed_status():
|
||||
from media_library_viewer_api.services.backup_alert_engine import generate_alerts_for_run
|
||||
|
||||
run = {
|
||||
"id": "run-1",
|
||||
"job_id": "job-1",
|
||||
"status": "failure",
|
||||
"bytes_transferred": 0,
|
||||
"duration_ms": 1000,
|
||||
"started_at": 1715392800,
|
||||
}
|
||||
alerts = generate_alerts_for_run(run, [], None)
|
||||
assert len(alerts) == 1
|
||||
assert alerts[0]["alert_type"] == "failed_status"
|
||||
assert alerts[0]["severity"] == "critical"
|
||||
|
||||
Reference in New Issue
Block a user