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