]> Cypherpunks repositories - gostls13.git/commitdiff
net: skip test affected by local network config on non-builder
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Sun, 26 Feb 2023 12:41:32 +0000 (19:41 +0700)
committerGopher Robot <gobot@golang.org>
Mon, 27 Feb 2023 11:55:26 +0000 (11:55 +0000)
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>

src/net/dnsclient_unix_test.go

index 990b3f99ce4225c90eac155f75a332f2f34484f5..0def954f8ceb6a7177444ef9e514c4b620a91e4d 100644 (file)
@@ -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)