2016-03-04 05:14:55 -05:00
|
|
|
package arm
|
|
|
|
|
|
|
|
import (
|
2016-04-21 19:50:03 -04:00
|
|
|
"testing"
|
2016-07-29 17:17:33 -04:00
|
|
|
|
2017-04-04 16:39:01 -04:00
|
|
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
2016-03-04 05:14:55 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestStateBagShouldBePopulatedExpectedValues(t *testing.T) {
|
|
|
|
var testSubject = &Builder{}
|
2016-04-21 19:50:03 -04:00
|
|
|
_, err := testSubject.Prepare(getArmBuilderConfiguration(), getPackerConfiguration())
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("failed to prepare: %s", err)
|
|
|
|
}
|
2016-03-04 05:14:55 -05:00
|
|
|
|
|
|
|
var expectedStateBagKeys = []string{
|
|
|
|
constants.AuthorizedKey,
|
|
|
|
|
2016-07-29 17:17:33 -04:00
|
|
|
constants.ArmTags,
|
2016-03-04 05:14:55 -05:00
|
|
|
constants.ArmComputeName,
|
|
|
|
constants.ArmDeploymentName,
|
2016-06-30 19:51:52 -04:00
|
|
|
constants.ArmNicName,
|
2016-03-04 05:14:55 -05:00
|
|
|
constants.ArmResourceGroupName,
|
2016-04-21 19:50:03 -04:00
|
|
|
constants.ArmStorageAccountName,
|
2016-03-04 05:14:55 -05:00
|
|
|
constants.ArmVirtualMachineCaptureParameters,
|
|
|
|
constants.ArmPublicIPAddressName,
|
2018-05-15 14:41:26 -04:00
|
|
|
constants.ArmAsyncResourceGroupDelete,
|
2016-03-04 05:14:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|