Add stub for validate test

This commit is contained in:
Chris Bednarski 2015-07-13 14:57:35 -07:00
parent d2339b7ccc
commit 28a13111b8
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,10 @@
{
"builders":[
{
"type":"file",
"target":"chocolate.txt",
"content":"chocolate"
}
],
"min_packer_version":"0.8.0"
}

32
command/validate_test.go Normal file
View File

@ -0,0 +1,32 @@
package command
import (
"path/filepath"
"testing"
)
func TestValidateCommand(t *testing.T) {
c := &ValidateCommand{
Meta: testMetaFile(t),
}
args := []string{
filepath.Join(testFixture("validate"), "template.json"),
}
defer cleanup()
if code := c.Run(args); code != 0 {
fatalCommand(t, c.Meta)
}
if !fileExists("chocolate.txt") {
t.Error("Expected to find chocolate.txt")
}
if !fileExists("vanilla.txt") {
t.Error("Expected to find vanilla.txt")
}
if fileExists("cherry.txt") {
t.Error("Expected NOT to find cherry.txt")
}
}