From fea626b6547eaf3e9c4f90094b837cff56278e2c Mon Sep 17 00:00:00 2001 From: Matt Moyer Date: Thu, 4 Mar 2021 17:19:59 -0600 Subject: [PATCH] Remove this proxy-related test code that we ended up not needing. Signed-off-by: Matt Moyer --- test/library/env.go | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/test/library/env.go b/test/library/env.go index d78f7d8b..0cf28a42 100644 --- a/test/library/env.go +++ b/test/library/env.go @@ -10,8 +10,6 @@ import ( "testing" "github.com/stretchr/testify/require" - "k8s.io/client-go/tools/clientcmd" - clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "sigs.k8s.io/yaml" auth1alpha1 "go.pinniped.dev/generated/latest/apis/concierge/authentication/v1alpha1" @@ -69,47 +67,10 @@ type TestOIDCUpstream struct { // ProxyEnv returns a set of environment variable strings (e.g., to combine with os.Environ()) which set up the configured test HTTP proxy. func (e *TestEnv) ProxyEnv() []string { - vars := e.proxyVars() - if vars == nil { - return nil - } - res := make([]string, 0, len(vars)) - for k, v := range vars { - res = append(res, k+"="+v) - } - return res -} - -func (e *TestEnv) InjectProxyEnvIntoKubeconfig(kubeconfigYAML string) string { - proxyVars := e.proxyVars() - if proxyVars == nil { - return kubeconfigYAML - } - - kubeconfig, err := clientcmd.Load([]byte(kubeconfigYAML)) - require.NoError(e.t, err) - for i := range kubeconfig.AuthInfos { - if exec := kubeconfig.AuthInfos[i].Exec; exec != nil { - for k, v := range proxyVars { - exec.Env = append(exec.Env, clientcmdapi.ExecEnvVar{Name: k, Value: v}) - } - } - } - - newYAML, err := clientcmd.Write(*kubeconfig) - require.NoError(e.t, err) - return string(newYAML) -} - -func (e *TestEnv) proxyVars() map[string]string { if e.Proxy == "" { return nil } - return map[string]string{ - "http_proxy": e.Proxy, - "https_proxy": e.Proxy, - "no_proxy": "127.0.0.1", - } + return []string{"http_proxy=" + e.Proxy, "https_proxy=" + e.Proxy, "no_proxy=127.0.0.1"} } // IntegrationEnv gets the integration test environment from OS environment variables. This