test(notifications): isolate queued routing snapshot

SetProcessor wakes the live queue worker while this test processes a fetched row manually. Defer the row beyond GetPending before installing the processor so a competing worker cannot decide the synchronous assertion.

Change-source: pulse-maintainer
This commit is contained in:
pulse-triage[bot]
2026-09-27 17:28:04 +01:00
parent f31730c935
commit 75aaf1391c
@@ -35,6 +35,13 @@ func TestQueuedEmailRoutingChangeAndResolution(t *testing.T) {
t.Fatalf("queued email = %v, %v", pending, err)
}
old := pending[0]
// The queue's background worker starts at construction and SetProcessor
// wakes it. Keep this row out of GetPending while exercising the
// already-fetched worker snapshot synchronously below.
futureRetry := time.Now().Add(time.Hour)
if _, err := q.db.Exec(`UPDATE notification_queue SET next_retry_at = ? WHERE id = ?`, futureRetry.Unix(), old.ID); err != nil {
t.Fatal(err)
}
n.SetInitialNotifyTarget("webhook")
// A fetched worker item must not defeat resolution cancellation.
if resolve {