@@ -29,7 +29,7 @@ import (
2929 "strings"
3030 "testing"
3131
32- "github.com/pkg/errors "
32+ "github.com/vmware/govmomi/vim25/soap "
3333
3434 "k8s.io/cloud-provider-vsphere/pkg/common/vclib"
3535 "k8s.io/cloud-provider-vsphere/pkg/common/vclib/fixtures"
@@ -134,7 +134,9 @@ func TestWithVerificationWithoutCaCertOrThumbprint(t *testing.T) {
134134
135135 _ , err := connection .NewClient (context .Background ())
136136
137- verifyWrappedX509UnkownAuthorityErr (t , err )
137+ if ! soap .IsCertificateUntrusted (err ) {
138+ t .Fatalf ("Expected soap.IsCertificateUntrusted, got: '%s' (%#v)" , err .Error (), err )
139+ }
138140}
139141
140142func TestWithValidThumbprint (t * testing.T ) {
@@ -184,21 +186,6 @@ func TestInvalidCaCert(t *testing.T) {
184186 }
185187}
186188
187- func verifyWrappedX509UnkownAuthorityErr (t * testing.T , err error ) {
188- urlErr , ok := err .(* url.Error )
189- if ! ok {
190- t .Fatalf ("Expected to receive an url.Error, got '%s' (%#v)" , err .Error (), err )
191- }
192- x509Err := & x509.UnknownAuthorityError {}
193- ok = errors .As (urlErr .Err , x509Err )
194- if ! ok {
195- t .Fatalf ("Expected to receive a wrapped x509.UnknownAuthorityError, got: '%s' (%#v)" , urlErr .Error (), urlErr )
196- }
197- if msg := x509Err .Error (); msg != "x509: certificate signed by unknown authority" {
198- t .Fatalf ("Expected 'signed by unknown authority' error, got: '%s'" , msg )
199- }
200- }
201-
202189func getRequestVerifier (t * testing.T ) (http.HandlerFunc , func ()) {
203190 gotRequest := false
204191
0 commit comments