fix(borg): send real archive statistics to Backup Sentinel #1
1 changed files with 31 additions and 0 deletions
31
tests/test_borg_sentinel_push.py
Normal file
31
tests/test_borg_sentinel_push.py
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
import json
|
||||||
|
import subprocess
|
||||||
|
import unittest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parent
|
||||||
|
SCRIPT = ROOT.parent / "roles" / "borg" / "files" / "borg-sentinel-push.py"
|
||||||
|
FIXTURE = ROOT / "fixtures" / "borgmatic-info-latest.json"
|
||||||
|
|
||||||
|
|
||||||
|
class SentinelPayloadRegressionTest(unittest.TestCase):
|
||||||
|
def test_real_borgmatic_info_shape_produces_nonzero_recent_backup_stats(self):
|
||||||
|
proc = subprocess.run(
|
||||||
|
["python3", str(SCRIPT), "--host", "pfannkuchen", "--info-file", str(FIXTURE), "--dry-run"],
|
||||||
|
text=True,
|
||||||
|
capture_output=True,
|
||||||
|
)
|
||||||
|
self.assertEqual(proc.returncode, 0, proc.stderr)
|
||||||
|
payload = json.loads(proc.stdout)
|
||||||
|
self.assertEqual(payload["host"], "pfannkuchen")
|
||||||
|
self.assertEqual(payload["status"], "ok")
|
||||||
|
self.assertEqual(payload["duration_sec"], 7)
|
||||||
|
self.assertEqual(payload["original_size"], 573861799)
|
||||||
|
self.assertEqual(payload["deduplicated_size"], 189532521)
|
||||||
|
self.assertEqual(payload["compressed_size"], 189978004)
|
||||||
|
self.assertEqual(payload["nfiles_new"], 157)
|
||||||
|
self.assertEqual(payload["archive"], "pfannkuchen-2026-07-29_11-53")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue