From 5dc379e2de79dbfc207bb9d6d44ad5a8c546f14a Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Sun, 26 Feb 2023 19:41:32 +0700 Subject: [PATCH] net: skip test affected by local network config on non-builder 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 Reviewed-by: Than McIntosh Run-TryBot: Cuong Manh Le Auto-Submit: Cuong Manh Le TryBot-Result: Gopher Robot --- src/net/dnsclient_unix_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/net/dnsclient_unix_test.go b/src/net/dnsclient_unix_test.go index 990b3f99ce..0def954f8c 100644 --- a/src/net/dnsclient_unix_test.go +++ b/src/net/dnsclient_unix_test.go @@ -10,6 +10,7 @@ import ( "context" "errors" "fmt" + "internal/testenv" "os" "path" "path/filepath" @@ -2199,7 +2200,7 @@ var goLookupIPCNAMEOrderDNSFilesModeTests = []struct { } 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) -- 2.50.0