github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/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 _, err := testSubject.Prepare(getArmBuilderConfiguration(), getPackerConfiguration()) 15 if err != nil { 16 t.Fatalf("failed to prepare: %s", err) 17 } 18 19 var expectedStateBagKeys = []string{ 20 constants.AuthorizedKey, 21 constants.PrivateKey, 22 23 constants.ArmTags, 24 constants.ArmComputeName, 25 constants.ArmDeploymentName, 26 constants.ArmLocation, 27 constants.ArmNicName, 28 constants.ArmResourceGroupName, 29 constants.ArmStorageAccountName, 30 constants.ArmVirtualMachineCaptureParameters, 31 constants.ArmPublicIPAddressName, 32 } 33 34 for _, v := range expectedStateBagKeys { 35 if _, ok := testSubject.stateBag.GetOk(v); ok == false { 36 t.Errorf("Expected the builder's state bag to contain '%s', but it did not.", v) 37 } 38 } 39 }