Notify via ntfy when the nightly backup fails
CI / tests (Python 3.10) (pull_request) Successful in 25s
CI / tests (Python 3.11) (pull_request) Successful in 24s
CI / tests (Python 3.12) (pull_request) Successful in 24s
CI / tests (Python 3.13) (pull_request) Successful in 25s
CI / lint (pull_request) Successful in 3s

kernelwatch-backup.service gets OnFailure=kernelwatch-backup-failed.service,
which runs notify-backup-failure, so timeouts, OOM kills and crashes are
reported as well as handled errors. The installer ships the new unit, and tests
check that every OnFailure= target is a real unit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
patrickandClaude Sonnet 5.5 committed 2026-10-30 11:13:33 -04:00
1 parent 8a9a3ca56d
commit 48960e6faf
6 files changed
+65 -1

No files matched your search

+9
View File
@@ -329,6 +329,15 @@ class ServerInstallTest(InstallCase):
for command in commands:
self.assertRegex(help_text, rf"\b{re.escape(command)}\b")
def test_on_failure_targets_are_shipped_units(self):
"""A typo'd OnFailure= is silently ignored by systemd, so check the names."""
units = {n for n in os.listdir(SERVER_DIR) if n.endswith((".service", ".timer"))}
targets = set()
for unit in units:
targets.update(re.findall(r"^OnFailure=(\S+)$", read(os.path.join(SERVER_DIR, unit)), re.M))
self.assertIn("kernelwatch-backup-failed.service", targets)
self.assertEqual(sorted(targets - units), [])
def test_existing_user_is_not_recreated(self):
self.install(KW_ID_RC="0")
self.assertFalse([c for c in self.calls() if c.startswith("useradd")])