Skip to content

Commit d694046

Browse files
ianlancetaylorgopherbot
authored andcommitted
net: ignore more errors in TestDialCancel
TestDialCancel assumes that packets sent to the private IP addresses 198.18.0.254 and 2001:2::254 will be routed to /dev/null. Not all systems are configured that way. We already ignore one error case in the test; ignore a couple more than have appeared on the builders. The test is still valid as long as some builders discard the packets as expected. Fixes #52579 Fixes #57364 Change-Id: Ibe9ed73b8b3b498623f1d18203dadf9207a0467e Reviewed-on: https://go-review.googlesource.com/c/go/+/496037 Reviewed-by: Damien Neil <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 58315a7 commit d694046

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

Diff for: src/net/dial_test.go

+11-8
Original file line numberDiff line numberDiff line change
@@ -736,12 +736,6 @@ func TestDialerKeepAlive(t *testing.T) {
736736
func TestDialCancel(t *testing.T) {
737737
mustHaveExternalNetwork(t)
738738

739-
if strings.HasPrefix(testenv.Builder(), "darwin-arm64") {
740-
// The darwin-arm64 machines run in an environment that's not
741-
// compatible with this test.
742-
t.Skipf("builder %q gives no route to host for 198.18.0.0", testenv.Builder())
743-
}
744-
745739
blackholeIPPort := JoinHostPort(slowDst4, "1234")
746740
if !supportsIPv4() {
747741
blackholeIPPort = JoinHostPort(slowDst6, "1234")
@@ -786,9 +780,18 @@ func TestDialCancel(t *testing.T) {
786780
if ticks < cancelTick {
787781
// Using strings.Contains is ugly but
788782
// may work on plan9 and windows.
789-
if strings.Contains(err.Error(), "connection refused") {
790-
t.Skipf("connection to %v failed fast with %v", blackholeIPPort, err)
783+
ignorable := []string{
784+
"connection refused",
785+
"unreachable",
786+
"no route to host",
791787
}
788+
e := err.Error()
789+
for _, ignore := range ignorable {
790+
if strings.Contains(e, ignore) {
791+
t.Skipf("connection to %v failed fast with %v", blackholeIPPort, err)
792+
}
793+
}
794+
792795
t.Fatalf("dial error after %d ticks (%d before cancel sent): %v",
793796
ticks, cancelTick-ticks, err)
794797
}

0 commit comments

Comments
 (0)