github.com/marksheahan/packer@v0.10.2-0.20160613200515-1acb2d6645a0/helper/communicator/step_connect_test.go (about) 1 package communicator 2 3 import ( 4 "bytes" 5 "testing" 6 7 "github.com/mitchellh/multistep" 8 "github.com/mitchellh/packer/packer" 9 ) 10 11 func TestStepConnect_impl(t *testing.T) { 12 var _ multistep.Step = new(StepConnect) 13 } 14 15 func TestStepConnect_none(t *testing.T) { 16 state := testState(t) 17 18 step := &StepConnect{ 19 Config: &Config{ 20 Type: "none", 21 }, 22 } 23 defer step.Cleanup(state) 24 25 // run the step 26 if action := step.Run(state); action != multistep.ActionContinue { 27 t.Fatalf("bad action: %#v", action) 28 } 29 } 30 31 func testState(t *testing.T) multistep.StateBag { 32 state := new(multistep.BasicStateBag) 33 state.Put("hook", &packer.MockHook{}) 34 state.Put("ui", &packer.BasicUi{ 35 Reader: new(bytes.Buffer), 36 Writer: new(bytes.Buffer), 37 }) 38 return state 39 }