Skip to content

Commit

Permalink
Fix a unit test by avoiding local kubeconfig
Browse files Browse the repository at this point in the history
The test naturally picks up on the local kubeconfig so we need
to intentionally set it to a "bad" value here.

Fixes #1345

Signed-off-by: John Schnake <jschnake@vmware.com>
  • Loading branch information
johnSchnake committed Jul 2, 2021
1 parent 564f622 commit 9f293f2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/sonobuoy/app/images_test.go
Expand Up @@ -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 {
Expand Down

0 comments on commit 9f293f2

Please sign in to comment.