Workaround tcpv4-only-systems connect issue in test

Fixes https://github.com/kubernetes/kubernetes/issues/47304.

Workarounds https://github.com/golang/go/issues/18806 (fixed in Go 1.9+).
pull/6/head
Dr. Stefan Schimanski 2017-07-10 09:26:06 +02:00
parent 5ca03d674e
commit 7ffa2faeac
1 changed files with 5 additions and 1 deletions

View File

@ -1444,7 +1444,11 @@ func tlsHandshake(t *testing.T, sCfg, cCfg *tls.Config) error {
}
}()
c, err := tls.Dial("tcp", s.Addr().String(), cCfg)
// workaround [::] not working in ipv4 only systems (https://github.com/golang/go/issues/18806)
// TODO: remove with Golang 1.9 with https://go-review.googlesource.com/c/45088/
addr := strings.TrimPrefix(s.Addr().String(), "[::]")
c, err := tls.Dial("tcp", addr, cCfg)
if err != nil {
// Intentionally not serializing the error received because we want to
// test for the failure case in the caller test function.