mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net: skip TestDialCancel if Dial fails with "connection refused"
Fixes #15191 Change-Id: I86214ede619400acd44f21138b5ddf6cef4649a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/205698 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
198f0452b0
commit
3eabdd291d
1 changed files with 6 additions and 4 deletions
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -759,10 +760,6 @@ func TestDialerKeepAlive(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDialCancel(t *testing.T) {
|
func TestDialCancel(t *testing.T) {
|
||||||
switch testenv.Builder() {
|
|
||||||
case "linux-arm64-buildlet":
|
|
||||||
t.Skip("skipping on linux-arm64-buildlet; incompatible network config? issue 15191")
|
|
||||||
}
|
|
||||||
mustHaveExternalNetwork(t)
|
mustHaveExternalNetwork(t)
|
||||||
|
|
||||||
blackholeIPPort := JoinHostPort(slowDst4, "1234")
|
blackholeIPPort := JoinHostPort(slowDst4, "1234")
|
||||||
|
|
@ -807,6 +804,11 @@ func TestDialCancel(t *testing.T) {
|
||||||
t.Error(perr)
|
t.Error(perr)
|
||||||
}
|
}
|
||||||
if ticks < cancelTick {
|
if ticks < cancelTick {
|
||||||
|
// Using strings.Contains is ugly but
|
||||||
|
// may work on plan9 and windows.
|
||||||
|
if strings.Contains(err.Error(), "connection refused") {
|
||||||
|
t.Skipf("connection to %v failed fast with %v", blackholeIPPort, err)
|
||||||
|
}
|
||||||
t.Fatalf("dial error after %d ticks (%d before cancel sent): %v",
|
t.Fatalf("dial error after %d ticks (%d before cancel sent): %v",
|
||||||
ticks, cancelTick-ticks, err)
|
ticks, cancelTick-ticks, err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue