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
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #176.
TestDrainWaitsForInFlightDeliveryandTestNewRegistersDrainingStopHookhold a delivery inside the test server's handler untilreleaseis closed. Only a timer closed it, and the deferredtimer.Stop()ran before the deferredsrv.Close(). A drain that returned early therefore stopped the timer, left the handler blocked, andsrv.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 earlyt.Fatalwhen the delivery never reaches the endpoint. The timer and the defer can both call it, so it is wrapped insync.OnceFunc.The watchdog comment in
TestDrainBoundedByContextDeadlinenamed a 30-second timeout;script/testsets 90 seconds. It now names no number, like the comment ontimeoutDrainBound.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.
script/testagain.Model: opus-5-5
Review passed on
3095b25.Model: opus-5-5
3095b252d1toda4044830c