net: skip external net tests on iOS

CL 113095 tried to deflake net tests on iOS by skipping the test
that uses the most sockets. That didn't work well enough and will
be reverted in CL 113555.

The flakes appeared after the iOS exec harness started to forward
environment variables, causing testenv.Builder to be non-empty on
the iOS builder. This CL attempts to fix the flakes with the more
conservative strategy of skipping tests that only run on builders.

The skipped tests happen to be those requiring external network
access; it's plausible that the iOS builder network isn't reliable
enough to run the many parallel DNS lookups and dial outs, while
keeping the number of open file descriptors below the 250 limit.

Change-Id: I9cafdaf2845dd6f3844c4819dcaaaa5970f5da15
Reviewed-on: https://go-review.googlesource.com/113575
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Elias Naur 2018-05-17 15:20:57 +02:00 committed by Brad Fitzpatrick
parent 67894aa7e2
commit 74604bb517
3 changed files with 28 additions and 51 deletions

View file

@ -749,9 +749,8 @@ func TestDialCancel(t *testing.T) {
switch testenv.Builder() {
case "linux-arm64-buildlet":
t.Skip("skipping on linux-arm64-buildlet; incompatible network config? issue 15191")
case "":
testenv.MustHaveExternalNetwork(t)
}
mustHaveExternalNetwork(t)
if runtime.GOOS == "nacl" {
// nacl doesn't have external network access.
@ -897,9 +896,7 @@ func TestCancelAfterDial(t *testing.T) {
// if the machine has halfway configured IPv6 such that it can bind on
// "::" not connect back to that same address.
func TestDialListenerAddr(t *testing.T) {
if testenv.Builder() == "" {
testenv.MustHaveExternalNetwork(t)
}
mustHaveExternalNetwork(t)
ln, err := Listen("tcp", ":0")
if err != nil {
t.Fatal(err)
@ -912,3 +909,13 @@ func TestDialListenerAddr(t *testing.T) {
}
c.Close()
}
// mustHaveExternalNetwork is like testenv.MustHaveExternalNetwork
// except that it won't skip testing on non-iOS builders.
func mustHaveExternalNetwork(t *testing.T) {
t.Helper()
ios := runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64")
if testenv.Builder() == "" || ios {
testenv.MustHaveExternalNetwork(t)
}
}