Skip to content

Commit

Permalink
e2e: treat stderr output as error
Browse files Browse the repository at this point in the history
This is to catch situations like

--- PASS: TestProxyGoogleCom (0.33s)
stderr: 2023/08/14 15:07:19 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>

exit status 1
  • Loading branch information
mmatczuk committed Aug 14, 2023
1 parent 32ff6be commit 5371943
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions e2e/setup/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,17 @@ func makeTestCallback(run string, debug bool) func() error {
return err
}

if stderr.Len() > 0 {
fmt.Fprintln(os.Stderr, "stderr:")
stderr.WriteTo(os.Stderr)
fmt.Fprintln(os.Stderr)
}

s := strings.Split(stdout.String(), "\n")
for _, l := range s {
if strings.HasPrefix(l, "---") {
fmt.Fprintln(os.Stdout, l)
}
}

if stderr.Len() > 0 {
return fmt.Errorf("stderr: %s", stderr.String())
}

return nil
}
}

0 comments on commit 5371943

Please sign in to comment.