aboutsummaryrefslogtreecommitdiff
path: root/src/net/timeout_test.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2023-08-30 10:48:09 -0400
committerGopher Robot <gobot@golang.org>2023-08-30 15:58:46 +0000
commita8d45a72eb7a204ff9e8189eb54d7ea3da1ea7a7 (patch)
tree444dca9e1e13638cbd4a31564e94f439022c9f72 /src/net/timeout_test.go
parent2fa7129836d65a3c44696747cc2cd9e9f391c66f (diff)
downloadgo-a8d45a72eb7a204ff9e8189eb54d7ea3da1ea7a7.tar.xz
net: skip TestDialTimeout subtests on Windows if Dial returns WSAECONNREFUSED
Since we have only seen this failure mode on windows/arm64, we do not skip on the Go project's windows/amd64 builders so that we will be more likely to find out whether this failure mode is specific to arm64. Also simplify the ECONNRESET check, since I've remembered that the error_*_test.go files exist. Fixes #62359. Updates #56876. Change-Id: I17bd678486f3d3ec3363a45986a711f570b013d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/524455 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/net/timeout_test.go')
-rw-r--r--src/net/timeout_test.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/net/timeout_test.go b/src/net/timeout_test.go
index 4218025fc0..cee1f49a05 100644
--- a/src/net/timeout_test.go
+++ b/src/net/timeout_test.go
@@ -13,7 +13,6 @@ import (
"io"
"os"
"runtime"
- "strings"
"sync"
"testing"
"time"
@@ -89,7 +88,7 @@ func TestDialTimeout(t *testing.T) {
}
}
- if strings.Contains(err.Error(), "connection reset by peer") && (testenv.Builder() == "" || runtime.GOOS == "freebsd") {
+ if isECONNRESET(err) && (testenv.Builder() == "" || runtime.GOOS == "freebsd") {
// After we set up the connection on Unix, we make a call to
// getsockopt to retrieve its status. Empirically, on some platforms
// (notably FreeBSD 13), we may see ECONNRESET from that call instead
@@ -115,6 +114,13 @@ func TestDialTimeout(t *testing.T) {
t.Skipf("skipping due to ECONNRESET with full accept queue")
}
+ if isWSAECONNREFUSED(err) && (testenv.Builder() == "" || runtime.GOARCH == "arm64") {
+ // A similar situation seems to occur on windows/arm64, but returning
+ // WSAECONNREFUSED from ConnectEx instead of ECONNRESET from getsockopt.
+ t.Logf("Dial: %v", err)
+ t.Skipf("skipping due to WSAECONNREFUSED with full accept queue")
+ }
+
if d.Deadline.IsZero() || afterDial.Before(d.Deadline) {
delay := afterDial.Sub(beforeDial)
if delay < tt.timeout {