packer-cn/packer/plugin/hook_test.go

27 lines
583 B
Go
Raw Normal View History

2013-05-11 13:46:17 -04:00
package plugin
import (
"cgl.tideland.biz/asserts"
"github.com/mitchellh/packer/packer"
"os/exec"
"testing"
)
type helperHook byte
func (helperHook) Run(string, packer.Ui, packer.Communicator, interface{}) {}
2013-05-11 13:46:17 -04:00
func TestHook_NoExist(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
_, err := Hook(exec.Command("i-should-never-ever-ever-exist"))
assert.NotNil(err, "should have an error")
}
func TestHook_Good(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
_, err := Hook(helperProcess("hook"))
assert.Nil(err, "should start hook properly")
}