nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 21.11 33 lines 1.4 kB view raw
1diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go 2index c902b1404f..66016088a2 100644 3--- a/src/internal/testenv/testenv.go 4+++ b/src/internal/testenv/testenv.go 5@@ -163,13 +163,15 @@ func MustHaveExecPath(t testing.TB, path string) { 6 // HasExternalNetwork reports whether the current system can use 7 // external (non-localhost) networks. 8 func HasExternalNetwork() bool { 9- return !testing.Short() && runtime.GOOS != "js" 10+ // Nix sandbox does not external network in sandbox 11+ return false 12 } 13 14 // MustHaveExternalNetwork checks that the current system can use 15 // external (non-localhost) networks. 16 // If not, MustHaveExternalNetwork calls t.Skip with an explanation. 17 func MustHaveExternalNetwork(t testing.TB) { 18+ t.Skipf("Nix sandbox does not have networking") 19 if runtime.GOOS == "js" { 20 t.Skipf("skipping test: no external network on %s", runtime.GOOS) 21 } 22diff --git a/src/net/dial_test.go b/src/net/dial_test.go 23index 57cf5554ad..d00be53b2c 100644 24--- a/src/net/dial_test.go 25+++ b/src/net/dial_test.go 26@@ -990,6 +990,7 @@ func TestDialerControl(t *testing.T) { 27 // except that it won't skip testing on non-mobile builders. 28 func mustHaveExternalNetwork(t *testing.T) { 29 t.Helper() 30+ t.Skipf("Nix sandbox does not have networking") 31 mobile := runtime.GOOS == "android" || runtime.GOOS == "ios" 32 if testenv.Builder() == "" || mobile { 33 testenv.MustHaveExternalNetwork(t)