github.com/sneal/packer@v0.5.2/builder/vmware/common/step_suppress_messages_test.go (about)

     1  package common
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/mitchellh/multistep"
     7  )
     8  
     9  func TestStepSuppressMessages_impl(t *testing.T) {
    10  	var _ multistep.Step = new(StepSuppressMessages)
    11  }
    12  
    13  func TestStepSuppressMessages(t *testing.T) {
    14  	state := testState(t)
    15  	step := new(StepSuppressMessages)
    16  
    17  	state.Put("vmx_path", "foo")
    18  
    19  	driver := state.Get("driver").(*DriverMock)
    20  
    21  	// Test the run
    22  	if action := step.Run(state); action != multistep.ActionContinue {
    23  		t.Fatalf("bad action: %#v", action)
    24  	}
    25  	if _, ok := state.GetOk("error"); ok {
    26  		t.Fatal("should NOT have error")
    27  	}
    28  
    29  	// Test the driver
    30  	if !driver.SuppressMessagesCalled {
    31  		t.Fatal("should've called")
    32  	}
    33  	if driver.SuppressMessagesPath != "foo" {
    34  		t.Fatal("should call with right path")
    35  	}
    36  }