2021-02-02 12:05:04 -05:00
|
|
|
package packer
|
2013-05-24 00:37:16 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestProvisioner_NoExist(t *testing.T) {
|
2021-02-02 12:05:04 -05:00
|
|
|
c := NewClient(&PluginClientConfig{Cmd: exec.Command("i-should-not-exist")})
|
2013-06-11 14:00:06 -04:00
|
|
|
defer c.Kill()
|
2013-05-24 00:37:16 -04:00
|
|
|
|
2013-06-11 14:00:06 -04:00
|
|
|
_, err := c.Provisioner()
|
|
|
|
if err == nil {
|
|
|
|
t.Fatal("should have error")
|
|
|
|
}
|
2013-05-24 00:37:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestProvisioner_Good(t *testing.T) {
|
2021-02-02 12:05:04 -05:00
|
|
|
c := NewClient(&PluginClientConfig{Cmd: helperProcess("provisioner")})
|
2013-06-11 14:00:06 -04:00
|
|
|
defer c.Kill()
|
2013-05-24 00:37:16 -04:00
|
|
|
|
2013-06-11 14:00:06 -04:00
|
|
|
_, err := c.Provisioner()
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("should not have error: %s", err)
|
|
|
|
}
|
2013-05-24 00:37:16 -04:00
|
|
|
}
|