e2e/cli/command: Wait() after execution

This commit is contained in:
Lars Lehtonen 2019-11-15 16:47:25 -08:00
parent a046a96d5e
commit c9383ca17d
No known key found for this signature in database
GPG key ID: 8137D474EBCB04F2

View file

@ -192,7 +192,6 @@ func (c *Run) runTest(opts *runOpts) (*TestReport, error) {
cmd := exec.Command(goBin, opts.goArgs()...) cmd := exec.Command(goBin, opts.goArgs()...)
cmd.Env = opts.goEnv() cmd.Env = opts.goEnv()
out, err := cmd.StdoutPipe() out, err := cmd.StdoutPipe()
defer out.Close()
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -202,6 +201,13 @@ func (c *Run) runTest(opts *runOpts) (*TestReport, error) {
return nil, err return nil, err
} }
err = cmd.Wait()
if err != nil {
// should command fail, log here then proceed to generate test report
// to report more informative info about which tests fail
c.logger.Error("test command failed", "error", err)
}
dec := NewDecoder(out) dec := NewDecoder(out)
report, err := dec.Decode(c.logger.Named("run.gotest")) report, err := dec.Decode(c.logger.Named("run.gotest"))
if err != nil { if err != nil {