mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-03 18:43:38 +01:00
Align watchdog smoke check with periodic alert projection
Require the scheduled, cancellation-aware projection to omit routine snapshot logs and keep the explicit diagnostic path covered. Change-source: pulse-maintainer
This commit is contained in:
@@ -138,6 +138,9 @@ class WatchdogHelpDocsTest(unittest.TestCase):
|
||||
schedule_src = (ROOT / "internal/monitoring/monitor_polling_schedule.go").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
alert_sync_src = (ROOT / "internal/monitoring/monitor_alert_sync.go").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
progress_src = (ROOT / "internal/monitoring/poll_work_progress.go").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
@@ -151,11 +154,21 @@ class WatchdogHelpDocsTest(unittest.TestCase):
|
||||
"defer progress.finishPlanning(id)",
|
||||
"m.taskQueue.upsertPlan(task, revision)",
|
||||
"m.state.UpdatePollStats(",
|
||||
"m.syncAlertsToState()",
|
||||
):
|
||||
with self.subTest(schedule_token=token):
|
||||
self.assertIn(token, schedule_src)
|
||||
|
||||
# A live scheduled cycle must still project acknowledgements, but
|
||||
# must not take the explicit sync path that logs routine snapshots.
|
||||
self.assertRegex(
|
||||
schedule_src,
|
||||
r"if ctx\.Err\(\) == nil \{\s*m\.projectAlertState\(false\)\s*\}",
|
||||
)
|
||||
self.assertRegex(
|
||||
alert_sync_src,
|
||||
r"func \(m \*Monitor\) syncAlertsToState\(\) \{\s*m\.projectAlertState\(true\)\s*\}",
|
||||
)
|
||||
|
||||
# The roster read uses the monitor context but can still return after
|
||||
# cancellation. Check that its result is discarded before publishing.
|
||||
self.assertRegex(
|
||||
|
||||
Reference in New Issue
Block a user