packer-cn/builder/vmware/vmx/step_clone_vmx_test.go

35 lines
713 B
Go
Raw Normal View History

2013-12-26 10:34:27 -05:00
package vmx
import (
"testing"
"github.com/mitchellh/multistep"
2013-12-26 16:39:41 -05:00
vmwcommon "github.com/mitchellh/packer/builder/vmware/common"
2013-12-26 10:34:27 -05:00
)
func TestStepCloneVMX_impl(t *testing.T) {
var _ multistep.Step = new(StepCloneVMX)
}
func TestStepCloneVMX(t *testing.T) {
state := testState(t)
step := new(StepCloneVMX)
2013-12-26 16:39:41 -05:00
step.OutputDir = "/foo"
step.Path = "/bar/bar.vmx"
2013-12-26 10:34:27 -05:00
step.VMName = "foo"
2013-12-26 16:39:41 -05:00
driver := state.Get("driver").(*vmwcommon.DriverMock)
2013-12-26 10:34:27 -05:00
// Test the run
if action := step.Run(state); action != multistep.ActionContinue {
t.Fatalf("bad action: %#v", action)
}
if _, ok := state.GetOk("error"); ok {
t.Fatal("should NOT have error")
}
2013-12-26 16:39:41 -05:00
if !driver.CloneCalled {
t.Fatal("clone should be called")
2013-12-26 10:34:27 -05:00
}
}