From 7c27cd08ada3390c3fa710989b33c2940c4a6bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20H=C3=B6rl?= Date: Mon, 18 Jun 2018 13:49:05 +0100 Subject: [PATCH] Check if the server actually configured with a certificate --- pkg/cloudprovider/providers/vsphere/vclib/connection_test.go | 3 +++ 1 file changed, 3 insertions(+) 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)