Files
Packer-Cn/builder/azure/arm/builder_test.go
T

36 lines
903 B
Go
Raw Normal View History

package arm
import (
2016-04-21 16:50:03 -07:00
"testing"
2016-07-29 14:17:33 -07:00
2017-04-04 13:39:01 -07:00
"github.com/hashicorp/packer/builder/azure/common/constants"
)
func TestStateBagShouldBePopulatedExpectedValues(t *testing.T) {
2019-12-17 11:25:56 +01:00
var testSubject Builder
_, _, err := testSubject.Prepare(getArmBuilderConfiguration(), getPackerConfiguration())
2016-04-21 16:50:03 -07:00
if err != nil {
t.Fatalf("failed to prepare: %s", err)
}
var expectedStateBagKeys = []string{
constants.AuthorizedKey,
2016-07-29 14:17:33 -07:00
constants.ArmTags,
constants.ArmComputeName,
constants.ArmDeploymentName,
2016-06-30 16:51:52 -07:00
constants.ArmNicName,
constants.ArmResourceGroupName,
2016-04-21 16:50:03 -07:00
constants.ArmStorageAccountName,
constants.ArmVirtualMachineCaptureParameters,
constants.ArmPublicIPAddressName,
2018-05-15 11:41:26 -07:00
constants.ArmAsyncResourceGroupDelete,
}
for _, v := range expectedStateBagKeys {
if _, ok := testSubject.stateBag.GetOk(v); ok == false {
t.Errorf("Expected the builder's state bag to contain '%s', but it did not.", v)
}
}
}