diff --git a/packer_test/commands_test.go b/packer_test/commands_test.go index fa6520996..b8d7bc584 100644 --- a/packer_test/commands_test.go +++ b/packer_test/commands_test.go @@ -138,6 +138,12 @@ func (pc *packerCommand) Run() (string, string, error) { pc.err = cmd.Run() + // Check that the command didn't panic, and if it did, we can immediately error + panicErr := PanicCheck{}.Check(pc.stdout.String(), pc.stderr.String(), pc.err) + if panicErr != nil { + pc.t.Fatalf("Packer panicked during execution: %s", panicErr) + } + return pc.stdout.String(), pc.stderr.String(), pc.err } @@ -147,8 +153,6 @@ func (pc *packerCommand) Assert(checks ...Checker) { attempt++ stdout, stderr, err := pc.Run() - checks = append(checks, PanicCheck{}) - for _, check := range checks { checkErr := check.Check(stdout, stderr, err) if checkErr != nil {