2013-05-24 00:37:16 -04:00
|
|
|
package plugin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"cgl.tideland.biz/asserts"
|
|
|
|
"github.com/mitchellh/packer/packer"
|
|
|
|
"os/exec"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
type helperProvisioner byte
|
|
|
|
|
2013-06-06 20:01:12 -04:00
|
|
|
func (helperProvisioner) Prepare(...interface{}) {}
|
2013-05-24 00:37:16 -04:00
|
|
|
|
|
|
|
func (helperProvisioner) Provision(packer.Ui, packer.Communicator) {}
|
|
|
|
|
|
|
|
func TestProvisioner_NoExist(t *testing.T) {
|
|
|
|
assert := asserts.NewTestingAsserts(t, true)
|
|
|
|
|
|
|
|
_, err := Provisioner(exec.Command("i-should-never-ever-ever-exist"))
|
|
|
|
assert.NotNil(err, "should have an error")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestProvisioner_Good(t *testing.T) {
|
|
|
|
assert := asserts.NewTestingAsserts(t, true)
|
|
|
|
|
|
|
|
_, err := Provisioner(helperProcess("provisioner"))
|
|
|
|
assert.Nil(err, "should start provisioner properly")
|
|
|
|
}
|