github.com/kikitux/packer@v0.10.1-0.20160322154024-6237df566f9f/builder/azure/arm/builder_test.go (about)

     1  // Copyright (c) Microsoft Corporation. All rights reserved.
     2  // Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
     3  
     4  package arm
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/mitchellh/packer/builder/azure/common/constants"
    10  )
    11  
    12  func TestStateBagShouldBePopulatedExpectedValues(t *testing.T) {
    13  	var testSubject = &Builder{}
    14  	testSubject.Prepare(getArmBuilderConfiguration(), getPackerConfiguration())
    15  
    16  	var expectedStateBagKeys = []string{
    17  		constants.AuthorizedKey,
    18  		constants.PrivateKey,
    19  
    20  		constants.ArmComputeName,
    21  		constants.ArmDeploymentName,
    22  		constants.ArmLocation,
    23  		constants.ArmResourceGroupName,
    24  		constants.ArmTemplateParameters,
    25  		constants.ArmVirtualMachineCaptureParameters,
    26  		constants.ArmPublicIPAddressName,
    27  	}
    28  
    29  	for _, v := range expectedStateBagKeys {
    30  		if _, ok := testSubject.stateBag.GetOk(v); ok == false {
    31  			t.Errorf("Expected the builder's state bag to contain '%s', but it did not.", v)
    32  		}
    33  	}
    34  }