mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-10-08 22:46:41 +00:00
fix(monitor): distinguish notification recovery and backup outcomes
This commit is contained in:
@@ -312,6 +312,7 @@ class RuntimeCatalogTests(unittest.TestCase):
|
||||
"backup_complete",
|
||||
{
|
||||
"hostname": "pve01", "storage": "pbs-main", "vmname": "alpha", "vmid": "100",
|
||||
"backup_outcome": "confirmed",
|
||||
"pve_title": "Backup job finished",
|
||||
"pve_message": (
|
||||
"INFO: Starting Backup of VM 100 (qemu)\n"
|
||||
@@ -322,7 +323,7 @@ class RuntimeCatalogTests(unittest.TestCase):
|
||||
},
|
||||
language="sk",
|
||||
)
|
||||
self.assertIn("Záloha dokončená", backup["title"])
|
||||
self.assertIn("záloha dokončená", backup["title"])
|
||||
self.assertNotIn("Backup job finished", backup["title"])
|
||||
self.assertIn("Veľkosť: 1.5 GiB", backup["body"])
|
||||
self.assertIn("Trvanie: 00:00:10", backup["body"])
|
||||
@@ -627,6 +628,7 @@ class RuntimeCatalogTests(unittest.TestCase):
|
||||
"_notification_language": "sk", "_event_type": event_type,
|
||||
"_group": "backup", "hostname": "pve01", "vmid": "100",
|
||||
"vmname": "alpha", "storage": "pbs-main",
|
||||
"backup_outcome": "confirmed" if event_type == "backup_complete" else "unconfirmed",
|
||||
},
|
||||
)
|
||||
self.assertIn(f">{localized_status}<", backup_html)
|
||||
|
||||
@@ -60,7 +60,7 @@ def _make_long_vzdump_report():
|
||||
|
||||
|
||||
class VzdumpWebhookTruncationTests(unittest.TestCase):
|
||||
def test_truncating_vzdump_report_at_4096_can_create_false_failed_backup(self):
|
||||
def test_truncating_vzdump_report_at_4096_leaves_guest_unconfirmed(self):
|
||||
full_message = _make_long_vzdump_report()
|
||||
truncated_message = full_message[:4096]
|
||||
|
||||
@@ -82,8 +82,8 @@ class VzdumpWebhookTruncationTests(unittest.TestCase):
|
||||
|
||||
self.assertEqual(truncated_dockflare["name"], "dockflare")
|
||||
self.assertEqual(truncated_dockflare["status"], "")
|
||||
self.assertIn("❌ dockflare (129)", truncated_body)
|
||||
self.assertIn("❌ 1 failed", truncated_body)
|
||||
self.assertIn("❔ dockflare (129)", truncated_body)
|
||||
self.assertNotIn("❌ 1 failed", truncated_body)
|
||||
|
||||
def test_webhook_handler_does_not_truncate_message_before_parsing(self):
|
||||
source = (SCRIPTS_DIR / "flask_notification_routes.py").read_text()
|
||||
|
||||
Reference in New Issue
Block a user