packer_test: dump command outs in case of failure

When a test fails to exert its assertions on the command-line output, a
test fails, but we don't necessarily can troubleshoot what happened,
especially when this happens in a CI environment.

Therefore, for convenience, we add the faculty for packerCommand.Assert
to automatically dump a command's output (both stdout and stderr) if a
test fails.
nywilken.document-tmpdir
Lucas Bajolet 2 years ago committed by Lucas Bajolet
parent 4a05d19a89
commit d65074c05c

@ -155,6 +155,10 @@ func (pc *packerCommand) Assert(checks ...Checker) {
if pc.t.Failed() {
pc.t.Errorf("attempt %d failed validation", attempt)
pc.t.Logf("dumping stdout: %s", stdout)
pc.t.Logf("dumping stdout: %s", stderr)
break
}
}

Loading…
Cancel
Save