github.com/mitchellh/packer@v1.3.2/builder/azure/arm/builder_test.go (about)

     1  package arm
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/packer/builder/azure/common/constants"
     7  )
     8  
     9  func TestStateBagShouldBePopulatedExpectedValues(t *testing.T) {
    10  	var testSubject = &Builder{}
    11  	_, err := testSubject.Prepare(getArmBuilderConfiguration(), getPackerConfiguration())
    12  	if err != nil {
    13  		t.Fatalf("failed to prepare: %s", err)
    14  	}
    15  
    16  	var expectedStateBagKeys = []string{
    17  		constants.AuthorizedKey,
    18  
    19  		constants.ArmTags,
    20  		constants.ArmComputeName,
    21  		constants.ArmDeploymentName,
    22  		constants.ArmNicName,
    23  		constants.ArmResourceGroupName,
    24  		constants.ArmStorageAccountName,
    25  		constants.ArmVirtualMachineCaptureParameters,
    26  		constants.ArmPublicIPAddressName,
    27  		constants.ArmAsyncResourceGroupDelete,
    28  	}
    29  
    30  	for _, v := range expectedStateBagKeys {
    31  		if _, ok := testSubject.stateBag.GetOk(v); ok == false {
    32  			t.Errorf("Expected the builder's state bag to contain '%s', but it did not.", v)
    33  		}
    34  	}
    35  }