2013-05-09 01:25:47 -04:00
|
|
|
package plugin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"cgl.tideland.biz/asserts"
|
|
|
|
"github.com/mitchellh/packer/packer"
|
|
|
|
"os/exec"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
type helperBuilder byte
|
|
|
|
|
2013-05-09 13:54:42 -04:00
|
|
|
func (helperBuilder) Prepare(interface{}) error {
|
|
|
|
return nil
|
|
|
|
}
|
2013-05-09 01:25:47 -04:00
|
|
|
|
2013-05-22 01:16:26 -04:00
|
|
|
func (helperBuilder) Run(packer.Ui, packer.Hook) packer.Artifact {
|
|
|
|
return nil
|
|
|
|
}
|
2013-05-09 01:25:47 -04:00
|
|
|
|
|
|
|
func TestBuilder_NoExist(t *testing.T) {
|
|
|
|
assert := asserts.NewTestingAsserts(t, true)
|
|
|
|
|
|
|
|
_, err := Builder(exec.Command("i-should-never-ever-ever-exist"))
|
|
|
|
assert.NotNil(err, "should have an error")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBuilder_Good(t *testing.T) {
|
|
|
|
assert := asserts.NewTestingAsserts(t, true)
|
|
|
|
|
|
|
|
_, err := Builder(helperProcess("builder"))
|
|
|
|
assert.Nil(err, "should start builder properly")
|
|
|
|
}
|