mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net: ignore network failures on some builders
We run the external network tests on builders, but some of our builders have less-than-ideal DNS connectivity. This change continues to run the tests on all builders, but marks certain builders as flaky (network-wise), and only validates their DNS results if they got DNS results. Change-Id: I826dc2a6f6da55add89ae9c6db892b3b2f7b526b Reviewed-on: https://go-review.googlesource.com/22852 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
61602b0e9e
commit
1ff57143af
2 changed files with 16 additions and 2 deletions
|
|
@ -16,6 +16,7 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
@ -133,3 +134,9 @@ func SkipFlaky(t *testing.T, issue int) {
|
||||||
t.Skipf("skipping known flaky test without the -flaky flag; see golang.org/issue/%d", issue)
|
t.Skipf("skipping known flaky test without the -flaky flag; see golang.org/issue/%d", issue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SkipFlakyNet(t *testing.T) {
|
||||||
|
if v, _ := strconv.ParseBool(os.Getenv("GO_BUILDER_FLAKY_NET")); v {
|
||||||
|
t.Skip("skipping test on builder known to have frequent network failures")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -498,6 +498,7 @@ func TestLookupDotsWithRemoteSource(t *testing.T) {
|
||||||
func testDots(t *testing.T, mode string) {
|
func testDots(t *testing.T, mode string) {
|
||||||
names, err := LookupAddr("8.8.8.8") // Google dns server
|
names, err := LookupAddr("8.8.8.8") // Google dns server
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
testenv.SkipFlakyNet(t)
|
||||||
t.Errorf("LookupAddr(8.8.8.8): %v (mode=%v)", err, mode)
|
t.Errorf("LookupAddr(8.8.8.8): %v (mode=%v)", err, mode)
|
||||||
} else {
|
} else {
|
||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
|
|
@ -509,12 +510,16 @@ func testDots(t *testing.T, mode string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cname, err := LookupCNAME("www.mit.edu")
|
cname, err := LookupCNAME("www.mit.edu")
|
||||||
if err != nil || !strings.HasSuffix(cname, ".") {
|
if err != nil {
|
||||||
t.Errorf("LookupCNAME(www.mit.edu) = %v, %v, want cname ending in . with trailing dot (mode=%v)", cname, err, mode)
|
testenv.SkipFlakyNet(t)
|
||||||
|
t.Errorf("LookupCNAME(www.mit.edu, mode=%v): %v", mode, err)
|
||||||
|
} else if !strings.HasSuffix(cname, ".") {
|
||||||
|
t.Errorf("LookupCNAME(www.mit.edu) = %v, want cname ending in . with trailing dot (mode=%v)", cname, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
mxs, err := LookupMX("google.com")
|
mxs, err := LookupMX("google.com")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
testenv.SkipFlakyNet(t)
|
||||||
t.Errorf("LookupMX(google.com): %v (mode=%v)", err, mode)
|
t.Errorf("LookupMX(google.com): %v (mode=%v)", err, mode)
|
||||||
} else {
|
} else {
|
||||||
for _, mx := range mxs {
|
for _, mx := range mxs {
|
||||||
|
|
@ -527,6 +532,7 @@ func testDots(t *testing.T, mode string) {
|
||||||
|
|
||||||
nss, err := LookupNS("google.com")
|
nss, err := LookupNS("google.com")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
testenv.SkipFlakyNet(t)
|
||||||
t.Errorf("LookupNS(google.com): %v (mode=%v)", err, mode)
|
t.Errorf("LookupNS(google.com): %v (mode=%v)", err, mode)
|
||||||
} else {
|
} else {
|
||||||
for _, ns := range nss {
|
for _, ns := range nss {
|
||||||
|
|
@ -539,6 +545,7 @@ func testDots(t *testing.T, mode string) {
|
||||||
|
|
||||||
cname, srvs, err := LookupSRV("xmpp-server", "tcp", "google.com")
|
cname, srvs, err := LookupSRV("xmpp-server", "tcp", "google.com")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
testenv.SkipFlakyNet(t)
|
||||||
t.Errorf("LookupSRV(xmpp-server, tcp, google.com): %v (mode=%v)", err, mode)
|
t.Errorf("LookupSRV(xmpp-server, tcp, google.com): %v (mode=%v)", err, mode)
|
||||||
} else {
|
} else {
|
||||||
if !strings.HasSuffix(cname, ".google.com.") {
|
if !strings.HasSuffix(cname, ".google.com.") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue