Tests that close a test server and then connect to its port fail other packages' tests when another test server takes that port in between. This is the cause in #158, in other tests.
Seen.make check on the branch of #253 at cde2f14, which changes only Core Rule Set tests, failed once in internal/rproxy:
TestQuestionNamesTheClientAsTheForwardedAddressesSay/the_peer,_with_no_header: rproxy_test.go:190: GET /api/v1/ip/203.0.113.9 is no report: EOF.
rproxy's stand-in for discriminator received a routewatch query. 203.0.113.9 is the client address of discriminator's tests (internal/discriminator/proxy_test.go).
TestUnreachableRouteWatchLetsTheRequestThroughAndSaysWhy in internal/discriminator/routewatchtags_test.go closes its stand-in and then sends routewatch queries to that port. rproxy's stand-in, in another test process, had taken the port.
The -v rerun in the same build passed.
TestRefusedConnectionFailsTheQueryAndTheLogOmitsTheClient in internal/routewatch/routewatch_test.go does the same, closing f.server before querying it.
Definition of done.
Both tests use an address that refuses connections without depending on a closed port staying free, as #158 did for its test.
No other test in the repo connects to a test server it has closed.
One reviewed PR into next, its title ending with (closes #N), N being this issue.
Model: opus-5-5
Tests that close a test server and then connect to its port fail other packages' tests when another test server takes that port in between. This is the cause in https://git.eeqj.de/sneak/smallwebwaf/issues/158, in other tests.
**Seen.** `make check` on the branch of https://git.eeqj.de/sneak/smallwebwaf/pulls/253 at `cde2f14`, which changes only Core Rule Set tests, failed once in `internal/rproxy`:
- `TestQuestionNamesTheClientAsTheForwardedAddressesSay/the_peer,_with_no_header`: `rproxy_test.go:190: GET /api/v1/ip/203.0.113.9 is no report: EOF`.
- rproxy's stand-in for discriminator received a routewatch query. `203.0.113.9` is the client address of discriminator's tests (`internal/discriminator/proxy_test.go`).
- `TestUnreachableRouteWatchLetsTheRequestThroughAndSaysWhy` in `internal/discriminator/routewatchtags_test.go` closes its stand-in and then sends routewatch queries to that port. rproxy's stand-in, in another test process, had taken the port.
- The `-v` rerun in the same build passed.
`TestRefusedConnectionFailsTheQueryAndTheLogOmitsTheClient` in `internal/routewatch/routewatch_test.go` does the same, closing `f.server` before querying it.
**Definition of done.**
- Both tests use an address that refuses connections without depending on a closed port staying free, as https://git.eeqj.de/sneak/smallwebwaf/issues/158 did for its test.
- No other test in the repo connects to a test server it has closed.
- One reviewed PR into `next`, its title ending with (closes #N), N being this issue.
Model: opus-5-5
Plan. Test files only, in the packages that hold the two tests: internal/discriminator/routewatchtags_test.go and internal/routewatch/routewatch_test.go.
Point each at an address nothing can connect to, as fdabf49 did for #158 in internal/smallwebwaf/healthcheck_test.go: a multicast address such as http://224.0.0.1, to which TCP cannot connect, with a one-line comment saying why. Keep each test's assertions as they are, unless the error text differs; then match the new text as narrowly as the old.
Search every _test.go file for a test server that is closed and then connected to (Close() on an httptest.Server followed by a request to its URL), and fix each the same way. Name each in the PR body.
No change to non-test code.
make fmt, then flock -w 1800 /srv/code/tmp/.gate-smallwebwaf.lock make check; a flock timeout also exits 1, so read the output. Label the PR needs-review.
Model: opus-5-5
**Plan.** Test files only, in the packages that hold the two tests: `internal/discriminator/routewatchtags_test.go` and `internal/routewatch/routewatch_test.go`.
- Point each at an address nothing can connect to, as `fdabf49` did for https://git.eeqj.de/sneak/smallwebwaf/issues/158 in `internal/smallwebwaf/healthcheck_test.go`: a multicast address such as `http://224.0.0.1`, to which TCP cannot connect, with a one-line comment saying why. Keep each test's assertions as they are, unless the error text differs; then match the new text as narrowly as the old.
- Search every `_test.go` file for a test server that is closed and then connected to (`Close()` on an `httptest.Server` followed by a request to its URL), and fix each the same way. Name each in the PR body.
- No change to non-test code.
`make fmt`, then `flock -w 1800 /srv/code/tmp/.gate-smallwebwaf.lock make check`; a `flock` timeout also exits 1, so read the output. Label the PR `needs-review`.
Model: opus-5-5
clawbot
self-assigned this 2026-11-09 23:10:00 +01:00
Built in #260. Both tests now use http://224.0.0.1. The search found one more test with the same fault: TestStalledRemoteLogEndpointHoldsUpNoRequest in internal/sww/sww_test.go closed its syslog endpoint before connecting to it again. It now keeps the endpoint open and closes each connection it takes.
Model: opus-5-5
Built in https://git.eeqj.de/sneak/smallwebwaf/pulls/260. Both tests now use `http://224.0.0.1`. The search found one more test with the same fault: `TestStalledRemoteLogEndpointHoldsUpNoRequest` in `internal/sww/sww_test.go` closed its syslog endpoint before connecting to it again. It now keeps the endpoint open and closes each connection it takes.
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.
Tests that close a test server and then connect to its port fail other packages' tests when another test server takes that port in between. This is the cause in #158, in other tests.
Seen.
make checkon the branch of #253 atcde2f14, which changes only Core Rule Set tests, failed once ininternal/rproxy:TestQuestionNamesTheClientAsTheForwardedAddressesSay/the_peer,_with_no_header:rproxy_test.go:190: GET /api/v1/ip/203.0.113.9 is no report: EOF.203.0.113.9is the client address of discriminator's tests (internal/discriminator/proxy_test.go).TestUnreachableRouteWatchLetsTheRequestThroughAndSaysWhyininternal/discriminator/routewatchtags_test.gocloses its stand-in and then sends routewatch queries to that port. rproxy's stand-in, in another test process, had taken the port.-vrerun in the same build passed.TestRefusedConnectionFailsTheQueryAndTheLogOmitsTheClientininternal/routewatch/routewatch_test.godoes the same, closingf.serverbefore querying it.Definition of done.
next, its title ending with (closes #N), N being this issue.Model: opus-5-5
Plan. Test files only, in the packages that hold the two tests:
internal/discriminator/routewatchtags_test.goandinternal/routewatch/routewatch_test.go.fdabf49did for #158 ininternal/smallwebwaf/healthcheck_test.go: a multicast address such ashttp://224.0.0.1, to which TCP cannot connect, with a one-line comment saying why. Keep each test's assertions as they are, unless the error text differs; then match the new text as narrowly as the old._test.gofile for a test server that is closed and then connected to (Close()on anhttptest.Serverfollowed by a request to its URL), and fix each the same way. Name each in the PR body.make fmt, thenflock -w 1800 /srv/code/tmp/.gate-smallwebwaf.lock make check; aflocktimeout also exits 1, so read the output. Label the PRneeds-review.Model: opus-5-5
Built in #260. Both tests now use
http://224.0.0.1. The search found one more test with the same fault:TestStalledRemoteLogEndpointHoldsUpNoRequestininternal/sww/sww_test.goclosed its syslog endpoint before connecting to it again. It now keeps the endpoint open and closes each connection it takes.Model: opus-5-5