packer-cn/builder/vmware/common/step_export_test.go

37 lines
769 B
Go
Raw Normal View History

2017-03-05 15:15:53 -05:00
package common
import (
2018-01-22 19:03:49 -05:00
"context"
"testing"
2018-01-22 20:21:10 -05:00
"github.com/hashicorp/packer/helper/multistep"
)
func TestStepExport_impl(t *testing.T) {
var _ multistep.Step = new(StepExport)
}
func testStepExport_wrongtype_impl(t *testing.T, remoteType string) {
state := testState(t)
step := new(StepExport)
2017-03-05 15:15:53 -05:00
var config DriverConfig
config.RemoteType = "foo"
2017-03-05 15:15:53 -05:00
state.Put("driverConfig", &config)
2018-01-22 19:03:49 -05:00
if action := step.Run(context.Background(), state); action != multistep.ActionContinue {
t.Fatalf("bad action: %#v", action)
}
if _, ok := state.GetOk("error"); ok {
t.Fatal("should NOT have error")
}
// Cleanup
step.Cleanup(state)
}
func TestStepExport_wrongtype_impl(t *testing.T) {
testStepExport_wrongtype_impl(t, "foo")
testStepExport_wrongtype_impl(t, "")
}