feat: add backup monitoring CRUD operations

This commit is contained in:
2026-05-11 20:38:13 +02:00
parent bd9765d4d9
commit dd375a7e16
2 changed files with 321 additions and 1 deletions
+26
View File
@@ -29,3 +29,29 @@ def test_backup_report_model():
)
assert report.name == "test-backup"
assert report.status == "success"
def test_create_job_and_run():
with tempfile.TemporaryDirectory() as tmpdir:
db_path = Path(tmpdir) / "test_settings.sqlite"
store = SettingsStore(db_path)
store.init_schema()
job = store.upsert_backup_job({
"name": "test-job",
"source": "server-a:/data",
"target": "server-b:/backups",
"schedule_interval_seconds": 86400,
})
assert job["name"] == "test-job"
run = store.create_backup_run({
"job_id": job["id"],
"started_at": 1715392800,
"status": "success",
"ended_at": 1715393700,
"duration_ms": 900000,
"bytes_transferred": 1024,
})
assert run["job_id"] == job["id"]
assert run["status"] == "success"