You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
packer/command/build_cleanup_script_test.go

33 lines
540 B

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package command
import (
"path/filepath"
"testing"
)
func TestBuildWithCleanupScript(t *testing.T) {
c := &BuildCommand{
Meta: TestMetaFile(t),
}
args := []string{
"-parallel-builds=1",
filepath.Join(testFixture("cleanup-script"), "template.json"),
}
defer cleanup()
// build should exit with error code!
if code := c.Run(args); code == 0 {
fatalCommand(t, c.Meta)
}
if !fileExists("ducky.txt") {
t.Errorf("Expected to find ducky.txt")
}
}