Merge pull request #15021 from Luap99/e2e-timeout-output

e2e: show command and output when a timeout happens
This commit is contained in:
OpenShift Merge Robot 2022-07-21 16:08:38 +02:00 committed by GitHub
commit 04ed519e9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -365,7 +365,11 @@ func (s *PodmanSession) WaitWithDefaultTimeout() {
// WaitWithTimeout waits for process finished with DefaultWaitTimeout // WaitWithTimeout waits for process finished with DefaultWaitTimeout
func (s *PodmanSession) WaitWithTimeout(timeout int) { 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.Stdout.Sync()
os.Stderr.Sync() os.Stderr.Sync()
fmt.Println("output:", s.OutputToString()) fmt.Println("output:", s.OutputToString())