mirror of
https://github.com/golang/go
synced 2024-11-17 06:54:48 -07:00
net: make mustHaveExternalNetwork work as usual on GOOS=linux
I considered deleting mustHaveExternalNetwork in favor of just using the real testenv.MustHaveExternalNetwork. That certainly makes these tests that call it easier to understand. But that negatively affects some ports that don't have a longtest builder as it'd make the tests not run automatically on any builder at all. So, make a minimal change that applies only to GOOS=linux for now. If we make more progress on establishing -longtest builders for all ports, this intermediate layer helper will cease to have any benefit and can be deleted in favor of the one in testenv package. Change-Id: Iaea207d98e780db429ab49e6e227650a8b35b786 Reviewed-on: https://go-review.googlesource.com/c/go/+/513416 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
parent
3bc28402fa
commit
9b0361e549
@ -1052,13 +1052,20 @@ func TestDialerControlContext(t *testing.T) {
|
||||
}
|
||||
|
||||
// mustHaveExternalNetwork is like testenv.MustHaveExternalNetwork
|
||||
// except that it won't skip testing on non-mobile builders.
|
||||
// except on non-Linux, non-mobile builders it permits the test to
|
||||
// run in -short mode.
|
||||
func mustHaveExternalNetwork(t *testing.T) {
|
||||
t.Helper()
|
||||
definitelyHasLongtestBuilder := runtime.GOOS == "linux"
|
||||
mobile := runtime.GOOS == "android" || runtime.GOOS == "ios"
|
||||
if testenv.Builder() == "" || mobile {
|
||||
testenv.MustHaveExternalNetwork(t)
|
||||
if testenv.Builder() != "" && !definitelyHasLongtestBuilder && !mobile {
|
||||
// On a non-Linux, non-mobile builder (e.g., freebsd-amd64-13_0).
|
||||
//
|
||||
// Don't skip testing because otherwise the test may never run on
|
||||
// any builder if this port doesn't also have a -longtest builder.
|
||||
return
|
||||
}
|
||||
testenv.MustHaveExternalNetwork(t)
|
||||
}
|
||||
|
||||
type contextWithNonZeroDeadline struct {
|
||||
|
Loading…
Reference in New Issue
Block a user