github.com/mitchellh/packer@v1.3.2/builder/vmware/common/step_suppress_messages_test.go (about)

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