github.com/askholme/packer@v0.7.2-0.20140924152349-70d9566a6852/packer/plugin/post_processor_test.go (about) 1 package plugin 2 3 import ( 4 "github.com/mitchellh/packer/packer" 5 "os/exec" 6 "testing" 7 ) 8 9 type helperPostProcessor byte 10 11 func (helperPostProcessor) Configure(...interface{}) error { 12 return nil 13 } 14 15 func (helperPostProcessor) PostProcess(packer.Ui, packer.Artifact) (packer.Artifact, bool, error) { 16 return nil, false, nil 17 } 18 19 func TestPostProcessor_NoExist(t *testing.T) { 20 c := NewClient(&ClientConfig{Cmd: exec.Command("i-should-not-exist")}) 21 defer c.Kill() 22 23 _, err := c.PostProcessor() 24 if err == nil { 25 t.Fatal("should have error") 26 } 27 } 28 29 func TestPostProcessor_Good(t *testing.T) { 30 c := NewClient(&ClientConfig{Cmd: helperProcess("post-processor")}) 31 defer c.Kill() 32 33 _, err := c.PostProcessor() 34 if err != nil { 35 t.Fatalf("should not have error: %s", err) 36 } 37 }