Skip to content

Commit

Permalink
e2e: show command and output when a timeout happens
Browse files Browse the repository at this point in the history
To make debugging easier we should see the command and its output when a
failure happens.

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Luap99 committed Jul 21, 2022
1 parent 712267e commit 3a016c6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,11 @@ func (s *PodmanSession) WaitWithDefaultTimeout() {

// WaitWithTimeout waits for process finished with DefaultWaitTimeout
func (s *PodmanSession) WaitWithTimeout(timeout int) {
Eventually(s, timeout).Should(Exit())
Eventually(s, timeout).Should(Exit(), func() string {
// in case of timeouts show output
return fmt.Sprintf("command %v timed out\nSTDOUT: %s\nSTDERR: %s",
s.Command.Args, string(s.Out.Contents()), string(s.Err.Contents()))
})
os.Stdout.Sync()
os.Stderr.Sync()
fmt.Println("output:", s.OutputToString())
Expand Down

0 comments on commit 3a016c6

Please sign in to comment.