mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
vclib: Modify x509.UnknownAuthorityError unwrap check
Modify unwrap error utility to make it work with go1.20 This version of Go introduces a new layer of wrapping via a new error type. The commit accounts for that while being compatible with go1.19 Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
This commit is contained in:
parent
e15cdb3513
commit
c31cc5ec46
@ -21,6 +21,7 @@ import (
|
||||
"crypto/sha1"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@ -187,12 +188,9 @@ func verifyWrappedX509UnkownAuthorityErr(t *testing.T, err error) {
|
||||
if !ok {
|
||||
t.Fatalf("Expected to receive an url.Error, got '%s' (%#v)", err.Error(), err)
|
||||
}
|
||||
x509Err, ok := urlErr.Err.(x509.UnknownAuthorityError)
|
||||
if !ok {
|
||||
t.Fatalf("Expected to receive a wrapped x509.UnknownAuthorityError, got: '%s' (%#v)", urlErr.Error(), urlErr)
|
||||
}
|
||||
if msg := x509Err.Error(); msg != "x509: certificate signed by unknown authority" {
|
||||
t.Fatalf("Expected 'signed by unknown authority' error, got: '%s'", msg)
|
||||
var x509err x509.UnknownAuthorityError
|
||||
if !errors.As(urlErr.Err, &x509err) {
|
||||
t.Fatalf("Expected to receive a wrapped x509.UnknownAuthorityError, got: '%s' (%#v)", urlErr.Err.Error(), urlErr.Err)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user