mirror of
https://github.com/golang/go
synced 2024-09-30 08:18:40 -06:00
net: convert TestTCPServer to use subtests
My fix in CL 202618 inadvertently violated an invariant in the inner loop of TestTCPServer (namely, that len(trchs) == i). That causes a panic when one or more of the channels is omitted due to a flake. Instead of trying to fix up the test, let's just factor out a subtest and skip the whole thing if the transceiver's Dial flakes out. Updates #32919 Change-Id: Ib6f274a44194311c8c5a2faf19f586cc9eccfd4d Reviewed-on: https://go-review.googlesource.com/c/go/+/202561 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
51504f0a2d
commit
22278ca0d4
@ -56,9 +56,9 @@ func TestTCPServer(t *testing.T) {
|
||||
const N = 3
|
||||
|
||||
for i, tt := range tcpServerTests {
|
||||
t.Run(tt.snet+" "+tt.saddr+"<-"+tt.taddr, func(t *testing.T) {
|
||||
if !testableListenArgs(tt.snet, tt.saddr, tt.taddr) {
|
||||
t.Logf("skipping %s test", tt.snet+" "+tt.saddr+"<-"+tt.taddr)
|
||||
continue
|
||||
t.Skip("not testable")
|
||||
}
|
||||
|
||||
ln, err := Listen(tt.snet, tt.saddr)
|
||||
@ -109,8 +109,7 @@ func TestTCPServer(t *testing.T) {
|
||||
// "i/o timeout" errors when dialing address ::1. The errors have not
|
||||
// been observed on newer versions of the OS, so we don't plan to work
|
||||
// around them. See https://golang.org/issue/32919.
|
||||
t.Logf("ignoring error on known-flaky macOS 10.12 builder: %v", err)
|
||||
continue
|
||||
t.Skipf("skipping due to error on known-flaky macOS 10.12 builder: %v", err)
|
||||
}
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -129,6 +128,7 @@ func TestTCPServer(t *testing.T) {
|
||||
t.Errorf("#%d: %v", i, err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user