github.com/yoctocloud/packer@v0.6.2-0.20160520224004-e11a0a18423f/packer/plugin/builder_test.go (about)

     1  package plugin
     2  
     3  import (
     4  	"os/exec"
     5  	"testing"
     6  )
     7  
     8  func TestBuilder_NoExist(t *testing.T) {
     9  	c := NewClient(&ClientConfig{Cmd: exec.Command("i-should-not-exist")})
    10  	defer c.Kill()
    11  
    12  	_, err := c.Builder()
    13  	if err == nil {
    14  		t.Fatal("should have error")
    15  	}
    16  }
    17  
    18  func TestBuilder_Good(t *testing.T) {
    19  	c := NewClient(&ClientConfig{Cmd: helperProcess("builder")})
    20  	defer c.Kill()
    21  
    22  	_, err := c.Builder()
    23  	if err != nil {
    24  		t.Fatalf("should not have error: %s", err)
    25  	}
    26  }