Skip to content

Commit

Permalink
Merge pull request #280 from sthaha/fix-test-failure-on-no-kubeconfig
Browse files Browse the repository at this point in the history
fix(test): export KUBECONFIG to oc only if set
  • Loading branch information
vimalk78 authored Oct 18, 2023
2 parents c669624 + 41464f3 commit aab30a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/utils/test/oc/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ func (r *runner) runCmd(timeoutCh <-chan time.Time) (string, error) {
r.Cmd.Stdout = &outbuf
r.Cmd.Stderr = &errbuf
}
r.Cmd.Env = []string{fmt.Sprintf("%s=%s", "KUBECONFIG", os.Getenv("KUBECONFIG"))}

if kc := os.Getenv("KUBECONFIG"); kc != "" {
r.Cmd.Env = append(r.Cmd.Env, fmt.Sprintf("%s=%s", "KUBECONFIG", kc))
}

cmdargs := strings.Join(r.args, " ")
err := r.Cmd.Start()
if err != nil {
Expand Down

0 comments on commit aab30a6

Please sign in to comment.