github.com/marksheahan/packer@v0.10.2-0.20160613200515-1acb2d6645a0/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 "github.com/mitchellh/packer/builder/azure/common/constants" 8 "testing" 9 ) 10 11 func TestStateBagShouldBePopulatedExpectedValues(t *testing.T) { 12 var testSubject = &Builder{} 13 _, err := testSubject.Prepare(getArmBuilderConfiguration(), getPackerConfiguration()) 14 if err != nil { 15 t.Fatalf("failed to prepare: %s", err) 16 } 17 18 var expectedStateBagKeys = []string{ 19 constants.AuthorizedKey, 20 constants.PrivateKey, 21 22 constants.ArmComputeName, 23 constants.ArmDeploymentName, 24 constants.ArmLocation, 25 constants.ArmResourceGroupName, 26 constants.ArmStorageAccountName, 27 constants.ArmVirtualMachineCaptureParameters, 28 constants.ArmPublicIPAddressName, 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 }