mirror of
https://github.com/golang/go
synced 2024-11-21 21:34:40 -07:00
net: make -external flag for tests default to true
go test -short # like in the build; no external stuff go test # long tests, + external go test -external=false # long tests, no external R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5696079
This commit is contained in:
parent
564a1f3358
commit
7301065fcc
@ -42,9 +42,8 @@ func doDial(t *testing.T, network, addr string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestLookupCNAME(t *testing.T) {
|
func TestLookupCNAME(t *testing.T) {
|
||||||
if testing.Short() {
|
if testing.Short() || !*testExternal {
|
||||||
// Don't use external network.
|
t.Logf("skipping test to avoid external network")
|
||||||
t.Logf("skipping external network test during -short")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cname, err := LookupCNAME("www.google.com")
|
cname, err := LookupCNAME("www.google.com")
|
||||||
@ -67,9 +66,8 @@ var googleaddrsipv4 = []string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDialGoogleIPv4(t *testing.T) {
|
func TestDialGoogleIPv4(t *testing.T) {
|
||||||
if testing.Short() {
|
if testing.Short() || !*testExternal {
|
||||||
// Don't use external network.
|
t.Logf("skipping test to avoid external network")
|
||||||
t.Logf("skipping external network test during -short")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,9 +122,8 @@ var googleaddrsipv6 = []string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDialGoogleIPv6(t *testing.T) {
|
func TestDialGoogleIPv6(t *testing.T) {
|
||||||
if testing.Short() {
|
if testing.Short() || !*testExternal {
|
||||||
// Don't use external network.
|
t.Logf("skipping test to avoid external network")
|
||||||
t.Logf("skipping external network test during -short")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Only run tcp6 if the kernel will take it.
|
// Only run tcp6 if the kernel will take it.
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var testExternal = flag.Bool("external", false, "allow use of external networks during test")
|
var testExternal = flag.Bool("external", true, "allow use of external networks during long test")
|
||||||
|
|
||||||
func TestGoogleSRV(t *testing.T) {
|
func TestGoogleSRV(t *testing.T) {
|
||||||
if testing.Short() || !*testExternal {
|
if testing.Short() || !*testExternal {
|
||||||
|
Loading…
Reference in New Issue
Block a user