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
|
|
|
|
|
2013-05-12 20:30:30 -04:00
|
|
|
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")
|
|
|
|
}
|