diff options
author | Bryan C. Mills <bcmills@google.com> | 2022-04-01 11:09:30 -0400 |
---|---|---|
committer | Heschi Kreinick <heschi@google.com> | 2022-04-01 17:39:53 +0000 |
commit | 32ff9b5de66ad2fa852b82f06897543e4b872105 (patch) | |
tree | 9e294b2d26bb2bcbe9d5f1ada4779c2b9dca934c | |
parent | 8b0583a05441b84a99d03daa78a24306c85cddd3 (diff) | |
download | go-32ff9b5de66ad2fa852b82f06897543e4b872105.tar.gz go-32ff9b5de66ad2fa852b82f06897543e4b872105.zip |
[release-branch.go1.18] crypto/x509: skip WSATRY_AGAIN errors when dialing badssl.com subdomains
(Temporarily, until the root cause of the test failure can be
diagnosed and fixed properly.)
For #52094
Change-Id: Iec69e162159f3f0a93135f742aac97cf82c1d96c
Reviewed-on: https://go-review.googlesource.com/c/go/+/397478
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit df89f2ba53aab53356be197c581d142cefc2c6bc)
Reviewed-on: https://go-review.googlesource.com/c/go/+/397594
Reviewed-by: Cherry Mui <cherryyz@google.com>
-rw-r--r-- | src/crypto/x509/root_windows_test.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/crypto/x509/root_windows_test.go b/src/crypto/x509/root_windows_test.go index ce6d9273d9..f6dafe4004 100644 --- a/src/crypto/x509/root_windows_test.go +++ b/src/crypto/x509/root_windows_test.go @@ -7,7 +7,11 @@ package x509_test import ( "crypto/tls" "crypto/x509" + "errors" "internal/testenv" + "net" + "strings" + "syscall" "testing" "time" ) @@ -17,10 +21,19 @@ func TestPlatformVerifier(t *testing.T) { t.Skip() } - getChain := func(host string) []*x509.Certificate { + getChain := func(t *testing.T, host string) []*x509.Certificate { t.Helper() c, err := tls.Dial("tcp", host+":443", &tls.Config{InsecureSkipVerify: true}) if err != nil { + // From https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2, + // matching the error string observed in https://go.dev/issue/52094. + const WSATRY_AGAIN syscall.Errno = 11002 + var errDNS *net.DNSError + if strings.HasSuffix(host, ".badssl.com") && errors.As(err, &errDNS) && strings.HasSuffix(errDNS.Err, WSATRY_AGAIN.Error()) { + t.Log(err) + testenv.SkipFlaky(t, 52094) + } + t.Fatalf("tls connection failed: %s", err) } return c.ConnectionState().PeerCertificates @@ -74,7 +87,7 @@ func TestPlatformVerifier(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - chain := getChain(tc.host) + chain := getChain(t, tc.host) var opts x509.VerifyOptions if len(chain) > 1 { opts.Intermediates = x509.NewCertPool() |