Fix a unit test by avoiding local kubeconfig
The test naturally picks up on the local kubeconfig so we need
to intentionally set it to a "bad" value here.
Fixes
@@ -95,6 +95,9 @@ func TestGetClusterVersion(t *testing.T) {
},
}
for _, tc := range testCases {
+ // Dont let actual local env impact these tests.
+ defer os.Setenv("KUBECONFIG", os.Getenv("KUBECONFIG"))
+ os.Setenv("KUBECONFIG", "/foo/bar/not/a/kubeconfig")
t.Run(tc.desc, func(t *testing.T) {
output, err := getClusterVersion(tc.input, Kubeconfig{})
switch {
