Test we halt if a bad path is set in vmx_path

This commit is contained in:
DanHam 2018-07-02 15:04:21 +01:00
parent 21117e5d38
commit a39c5887fb
No known key found for this signature in database
GPG Key ID: 58E79AEDD6AA987E
1 changed files with 16 additions and 0 deletions

View File

@ -252,3 +252,19 @@ func TestStepConfigureVMX_displayNameStore(t *testing.T) {
t.Fatalf("displayName should be stored in the statebag as 'display_name'")
}
}
func TestStepConfigureVMX_vmxPathBad(t *testing.T) {
state := testState(t)
step := new(StepConfigureVMX)
state.Put("vmx_path", "some_bad_path")
// Test the run
if action := step.Run(context.Background(), state); action != multistep.ActionHalt {
t.Fatalf("bad action: %#v. Should halt when vmxPath is bad", action)
}
if _, ok := state.GetOk("error"); !ok {
t.Fatal("should store error in state when vmxPath is bad")
}
}