TestUnroutedEmptyEncodedStreamIsBounded/gzip went red with TempDir's
RemoveAll "directory not empty". The cause: once magpie answers a held
request, giveUp writes its report from the timer's goroutine after the
answer, so the report could land in the test's temp HOME while
t.TempDir's cleanup was removing it.
unroutedHold now has a saved channel that giveUp closes once its report
is written. watchedHold registers a cleanup (holdReported) that waits for
it, up to 30s, when magpie answered the hold.
Run:
- Broken by hand: a sleep before the report write, with a marker for a
write after cleanup. Without the wait: 3 writes after cleanup; with
it: 0.
- mote, at a268aadc4 + this change: gofmt -l clean; GOOS=windows go vet
and GOOS=linux go vet -tags nogui ./internal/gateway ok;
go test -tags nogui -count=1 -timeout 45m ./internal/gateway ok
(903.8s).
- Rebased on 823e7c250: gofmt clean, linux vet ok, go test -count=3
-run "Unrouted|Held" ok (159s) at the pushed head.
Not tried: Windows or Linux test runs of the package.