mirror of
https://github.com/hashicorp/packer.git
synced 2026-03-02 13:31:57 -05:00
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
32 lines
539 B
Go
32 lines
539 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
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")
|
|
}
|
|
|
|
}
|