packer-cn/packer/plugin/builder_test.go

35 lines
720 B
Go
Raw Normal View History

package plugin
import (
"cgl.tideland.biz/asserts"
"github.com/mitchellh/packer/packer"
"os/exec"
"testing"
)
type helperBuilder byte
func (helperBuilder) Prepare(interface{}) error {
return nil
}
2013-06-10 01:00:47 -04:00
func (helperBuilder) Run(packer.Ui, packer.Hook, packer.Cache) packer.Artifact {
return nil
}
func (helperBuilder) Cancel() {}
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")
}