Commit 22278ca0 authored by Bryan C. Mills's avatar Bryan C. Mills

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 51504f0a
......@@ -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)
}
}
})
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment