github.com/StackPointCloud/packer@v0.10.2-0.20180716202532-b28098e0f79b/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 constants.PrivateKey, 19 20 constants.ArmTags, 21 constants.ArmComputeName, 22 constants.ArmDeploymentName, 23 constants.ArmNicName, 24 constants.ArmResourceGroupName, 25 constants.ArmStorageAccountName, 26 constants.ArmVirtualMachineCaptureParameters, 27 constants.ArmPublicIPAddressName, 28 constants.ArmAsyncResourceGroupDelete, 29 } 30 31 for _, v := range expectedStateBagKeys { 32 if _, ok := testSubject.stateBag.GetOk(v); ok == false { 33 t.Errorf("Expected the builder's state bag to contain '%s', but it did not.", v) 34 } 35 } 36 }