1 Commits
Author SHA1 Message Date
sneak a96e54cd1a Tests no longer connect to test servers they closed (closes #257)
check / check (push) Successful in 4m29s
Four tests closed a test server or stopped discriminator, and then
connected to its port. Another test process could take that port in
between and receive the connection.

- TestUnreachableRouteWatchLetsTheRequestThroughAndSaysWhy and
  TestUnreachableRoutewatchFailsTheQueryAndTheLogOmitsTheClient, formerly
  TestRefusedConnection..., point routewatch at 224.0.0.1, a multicast
  address to which TCP cannot connect.
- TestStalledRemoteLogEndpointHoldsUpNoRequest keeps its endpoint open
  and closes each connection it takes, instead of closing the endpoint.
- TestTheSiteAnswersWhileDiscriminatorIsStoppedAndStartedAgain gives
  rproxy an address the test holds throughout. The test forwards each
  connection there to the running discriminator, and closes it while
  discriminator is stopped.

No change to non-test code.

Model: opus-5-5
2026-11-09 23:04:10 +00:00
+5 -5
View File
@@ -280,7 +280,7 @@ func startForwarder(t *testing.T) (string, func(addr string)) {
}) })
var ( var (
mu sync.Mutex lock sync.Mutex
to string to string
) )
@@ -288,8 +288,8 @@ func startForwarder(t *testing.T) (string, func(addr string)) {
// holds the lock throughout, so once another address is set, nothing // holds the lock throughout, so once another address is set, nothing
// connects to the one before. // connects to the one before.
dial := func() net.Conn { dial := func() net.Conn {
mu.Lock() lock.Lock()
defer mu.Unlock() defer lock.Unlock()
if to == "" { if to == "" {
return nil return nil
@@ -323,8 +323,8 @@ func startForwarder(t *testing.T) (string, func(addr string)) {
}() }()
return listener.Addr().String(), func(addr string) { return listener.Addr().String(), func(addr string) {
mu.Lock() lock.Lock()
defer mu.Unlock() defer lock.Unlock()
to = addr to = addr
} }