notify: release held deliveries so shutdown tests fail, not hang (closes #176) #179

Merged
clawbot merged 1 commits from issue-176-notify-test-hang into next 2026-10-01 21:58:59 +02:00
Collaborator

Closes #176.

TestDrainWaitsForInFlightDelivery and TestNewRegistersDrainingStopHook hold a delivery inside the test server's handler until release is closed. Only a timer closed it, and the deferred timer.Stop() ran before the deferred srv.Close(). A drain that returned early therefore stopped the timer, left the handler blocked, and srv.Close() waited on it until the package timed out, instead of the test failing.

Each test now defers a release of the handler right after starting the server. Deferred calls run last in, first out, so the release runs before srv.Close() on every exit path, including the early t.Fatal when the delivery never reaches the endpoint. The timer and the defer can both call it, so it is wrapped in sync.OnceFunc.

The watchdog comment in TestDrainBoundedByContextDeadline named a 30-second timeout; script/test sets 90 seconds. It now names no number, like the comment on timeoutDrainBound.

No timing bound changed; test-only.

Shown by making the drain return at once by hand: both tests then failed within seconds with their own messages instead of hanging; the break was reverted.

  • Judgement call: the watchdog comment names no number rather than 90 seconds, so it cannot drift from script/test again.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/dnswatcher/issues/176. `TestDrainWaitsForInFlightDelivery` and `TestNewRegistersDrainingStopHook` hold a delivery inside the test server's handler until `release` is closed. Only a timer closed it, and the deferred `timer.Stop()` ran before the deferred `srv.Close()`. A drain that returned early therefore stopped the timer, left the handler blocked, and `srv.Close()` waited on it until the package timed out, instead of the test failing. Each test now defers a release of the handler right after starting the server. Deferred calls run last in, first out, so the release runs before `srv.Close()` on every exit path, including the early `t.Fatal` when the delivery never reaches the endpoint. The timer and the defer can both call it, so it is wrapped in `sync.OnceFunc`. The watchdog comment in `TestDrainBoundedByContextDeadline` named a 30-second timeout; `script/test` sets 90 seconds. It now names no number, like the comment on `timeoutDrainBound`. No timing bound changed; test-only. Shown by making the drain return at once by hand: both tests then failed within seconds with their own messages instead of hanging; the break was reverted. - Judgement call: the watchdog comment names no number rather than 90 seconds, so it cannot drift from `script/test` again. Model: opus-5-5
clawbot added the needs-review label 2026-10-01 21:36:37 +02:00
clawbot self-assigned this 2026-10-01 21:36:37 +02:00
Author
Collaborator

Review passed on 3095b25.

Model: opus-5-5

Review passed on 3095b25. Model: opus-5-5
clawbot added 1 commit 2026-10-01 21:58:35 +02:00
Two shutdown tests hold a delivery inside the test server's handler and
release it from a timer. The deferred timer stop ran before the server
was closed, so a drain that returned early left the handler blocked and
the server's close waited on it until the package timed out. Each test
now defers a release, guarded so the timer and the defer can both call
it, ahead of closing the server. The watchdog comment no longer names a
30-second timeout the test script does not use.

Model: opus-5-5
clawbot force-pushed issue-176-notify-test-hang from 3095b252d1 to da4044830c 2026-10-01 21:58:35 +02:00 Compare
clawbot merged commit e93c2664b8 into next 2026-10-01 21:58:59 +02:00
clawbot deleted branch issue-176-notify-test-hang 2026-10-01 21:58:59 +02:00
clawbot removed the needs-review label 2026-10-01 21:58:59 +02:00
Sign in to join this conversation.