From f7b0cf8f8a43211e36c7356bc579ccbd42fa0ccb Mon Sep 17 00:00:00 2001 From: Matt Moyer Date: Mon, 27 Jul 2020 07:52:36 -0500 Subject: [PATCH] Fix a bad assumption in library.NewClientConfigWithCertAndKey. It turns out these fields are not meant to be base64 encoded, even though that's how they are in the kubeconfig. Signed-off-by: Matt Moyer --- test/library/client.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/library/client.go b/test/library/client.go index 308fbc5a..fbdd9e42 100644 --- a/test/library/client.go +++ b/test/library/client.go @@ -6,7 +6,6 @@ SPDX-License-Identifier: Apache-2.0 package library import ( - "encoding/base64" "testing" "github.com/stretchr/testify/require" @@ -29,8 +28,8 @@ func NewClientConfigWithCertAndKey(t *testing.T, cert, key string) *rest.Config return newClientConfigWithOverrides(t, &clientcmd.ConfigOverrides{ AuthInfo: clientcmdapi.AuthInfo{ - ClientCertificateData: []byte(base64.StdEncoding.EncodeToString([]byte(cert))), - ClientKeyData: []byte(base64.StdEncoding.EncodeToString([]byte(key))), + ClientCertificateData: []byte(cert), + ClientKeyData: []byte(key), }, }) } @@ -54,7 +53,9 @@ func NewClientset(t *testing.T) kubernetes.Interface { func NewClientsetWithConfig(t *testing.T, config *rest.Config) kubernetes.Interface { t.Helper() - return kubernetes.NewForConfigOrDie(config) + result, err := kubernetes.NewForConfig(config) + require.NoError(t, err, "unexpected failure from kubernetes.NewForConfig()") + return result } func NewPlaceholderNameClientset(t *testing.T) placeholdernameclientset.Interface {