server: assert timeouts on the served http.Server, not just the constructor (closes #120)
check / check (push) Failing after 1s

The timeout tests called newHTTPServer directly, leaving Run's call
site unguarded: a Run that built its http.Server inline would drop
every timeout with the suite still green. TestRunWiresSocketTimeouts
now wires a Server as cmd/dnswatcher does (minus watcher and resolver,
so no live DNS), drives Run with an unbindable port so it stores its
http.Server and returns without listening, and asserts the served
server carries all four timeouts and both required relationships.
Reverting Run to an inline http.Server without timeouts fails it. The
near-tautological addr/handler test is dropped; the wiring test covers
the handler end to end.

The read-deadline note is corrected: a too-small ReadTimeout does not
make ReadHeaderTimeout unreachable (net/http applies it directly); it
installs an already-expired whole-request deadline. Verified against
the pinned go1.25 net/http.

Model: opus-4-8
This commit is contained in:
2026-09-21 07:51:28 +00:00
parent b351a2350c
commit 71b8d46f7b
3 changed files with 122 additions and 88 deletions
+5
View File
@@ -23,8 +23,13 @@ Rationale, Design, TODO, License, Author) if any are still missing.
# Completed Steps
- 2026-09-21: server timeout test now drives `Run` and asserts the
served `http.Server` carries the timeouts; corrected the inverted
`ReadTimeout` rationale note (#120).
- 2026-09-21: `go mod tidy` dropped the redundant `golang.org/x/sync`
`// indirect` line so `script/bootstrap` leaves a clean tree (#132)
- 2026-08-10: comment-only corrections to `script/bootstrap`,
`script/cibuild`, and `Dockerfile.lint`. The `goimports` pin in
`script/bootstrap` was justified by a claim that `script/fmt-check`