From 3a016c6e4962d395fee101c36650fd6d4fc3223a Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 21 Jul 2022 14:18:44 +0200 Subject: [PATCH] e2e: show command and output when a timeout happens To make debugging easier we should see the command and its output when a failure happens. Signed-off-by: Paul Holzinger --- test/utils/utils.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/utils/utils.go b/test/utils/utils.go index 36f5a94143..924f66ec85 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -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())