github.com/yoctocloud/packer@v0.6.2-0.20160520224004-e11a0a18423f/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.ArmTemplateParameters, 28 constants.ArmVirtualMachineCaptureParameters, 29 constants.ArmPublicIPAddressName, 30 } 31 32 for _, v := range expectedStateBagKeys { 33 if _, ok := testSubject.stateBag.GetOk(v); ok == false { 34 t.Errorf("Expected the builder's state bag to contain '%s', but it did not.", v) 35 } 36 } 37 }