packer/plugin: new Builder interface
This commit is contained in:
parent
af7b8d1e15
commit
58e8d9ac56
|
@ -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)
|
||||
|
|
|
@ -1,23 +1,10 @@
|
|||
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":
|
||||
|
|
Loading…
Reference in New Issue