diff --git a/pkg/cloudprovider/providers/vsphere/vclib/connection_test.go b/pkg/cloudprovider/providers/vsphere/vclib/connection_test.go index 394a6adccaf..05fe4cd3ed4 100644 --- a/pkg/cloudprovider/providers/vsphere/vclib/connection_test.go +++ b/pkg/cloudprovider/providers/vsphere/vclib/connection_test.go @@ -65,6 +65,9 @@ func createTestServer( } // calculate the leaf certificate's fingerprint + if len(server.TLS.Certificates) < 1 || len(server.TLS.Certificates[0].Certificate) < 1 { + t.Fatal("Expected server.TLS.Certificates not to be empty") + } x509LeafCert := server.TLS.Certificates[0].Certificate[0] tpBytes := sha1.Sum(x509LeafCert) tpString := fmt.Sprintf("%x", tpBytes)