Commit 82cbf13f authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer/plugin: new Builder interface

parent b2b125d8
......@@ -10,7 +10,7 @@ type cmdBuilder struct {
client *Client
}
func (b *cmdBuilder) Prepare(config ...interface{}) error {
func (b *cmdBuilder) Prepare(config ...interface{}) ([]string, error) {
defer func() {
r := recover()
b.checkExit(r, nil)
......
package plugin
import (
"github.com/mitchellh/packer/packer"
"os/exec"
"testing"
)
type helperBuilder byte
func (helperBuilder) Prepare(...interface{}) error {
return nil
}
func (helperBuilder) Run(packer.Ui, packer.Hook, packer.Cache) (packer.Artifact, error) {
return nil, nil
}
func (helperBuilder) Cancel() {}
func TestBuilder_NoExist(t *testing.T) {
c := NewClient(&ClientConfig{Cmd: exec.Command("i-should-not-exist")})
defer c.Kill()
......
......@@ -54,7 +54,7 @@ func TestHelperProcess(*testing.T) {
fmt.Printf("%s1|:1234\n", APIVersion)
<-make(chan int)
case "builder":
ServeBuilder(new(helperBuilder))
ServeBuilder(new(packer.MockBuilder))
case "command":
ServeCommand(new(helperCommand))
case "hook":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment