CL 461275 uses testing.Short to skip this kind of tests. But it may lead
to false positive, because testing.Short may not always set. For
example, the normal workflow when testing changes in net package is
running:
go test -v net
in local machine, that will cause the test failed.
Using testenv.Builder is better, since when it's the standard way to
check whether the test is running on builder or local machine.
Change-Id: Ia5347eb76b4f0415dde8fa3d6c89bd0105f15aa7
Reviewed-on: https://go-review.googlesource.com/c/go/+/471437
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
"context"
"errors"
"fmt"
+ "internal/testenv"
"os"
"path"
"path/filepath"
}
func TestGoLookupIPCNAMEOrderHostsAliasesDNSFilesMode(t *testing.T) {
- if testing.Short() {
+ if testenv.Builder() == "" {
t.Skip("Makes assumptions about local networks and (re)naming that aren't always true")
}
defer func(orig string) { testHookHostsPath = orig }(testHookHostsPath)