Remove this proxy-related test code that we ended up not needing.

Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Matt Moyer 2021-03-04 17:19:59 -06:00
parent 16163b989b
commit fea626b654
No known key found for this signature in database
GPG Key ID: EAE88AD172C5AE2D

View File

@ -10,8 +10,6 @@ import (
"testing" "testing"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
"sigs.k8s.io/yaml" "sigs.k8s.io/yaml"
auth1alpha1 "go.pinniped.dev/generated/latest/apis/concierge/authentication/v1alpha1" 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. // 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 { 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 == "" { if e.Proxy == "" {
return nil return nil
} }
return map[string]string{ return []string{"http_proxy=" + e.Proxy, "https_proxy=" + e.Proxy, "no_proxy=127.0.0.1"}
"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 // IntegrationEnv gets the integration test environment from OS environment variables. This