Skip to content

Commit

Permalink
Return shell errors with output
Browse files Browse the repository at this point in the history
Signed-off-by: Dale Haiducek <[email protected]>
(cherry picked from commit 5a8e5b6)
  • Loading branch information
dhaiducek authored and magic-mirror-bot[bot] committed Feb 19, 2024
1 parent 41d31c0 commit 5889cb0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,14 @@ func Kubectl(args ...string) {

// KubectlWithOutput execute kubectl cli and return output and error
func KubectlWithOutput(args ...string) (string, error) {
output, err := exec.Command("kubectl", args...).CombinedOutput()
//nolint:forbidigo
fmt.Println(string(output))
kubectlCmd := exec.Command("kubectl", args...)

return string(output), err
output, err := kubectlCmd.CombinedOutput()
if err != nil {
return string(output), fmt.Errorf("error running kubectl command: %s: %s", output, err.Error())
}

return string(output), nil
}

// GetMetrics execs into the propagator pod and curls the metrics endpoint, filters
Expand Down

0 comments on commit 5889cb0

Please sign in to comment.