Skip to content

Commit

Permalink
Print error and output on test metal cli command error
Browse files Browse the repository at this point in the history
Signed-off-by: Ayush Rangwala <[email protected]>
  • Loading branch information
aayushrangwala committed Jan 29, 2024
1 parent e44373e commit 268a1ff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,15 +587,15 @@ func ExecuteAndCaptureOutput(t *testing.T, root *cobra.Command) []byte {

os.Stdout = rescueStdout

if err != nil {
t.Fatal(err)
}

out, ioErr := io.ReadAll(r)
if ioErr != nil {
t.Logf("error while reading command output: %v", ioErr)
}

if err != nil {
t.Fatalf("Failed to execute command with err: [%s]\n with output:\n%s", err.Error(), out)
}

return out
}

Expand Down

0 comments on commit 268a1ff

Please sign in to comment.