packer-cn/builder/azure/arm/builder_test.go
Jamie Lennox d043c37ad4 Azure: Don't provide location for build_resource_group_name
Location is required by default because you must specify where to create
the resource group containing the packer resources.

When using build_resource_group_name you are specifying that packer
should use an existing resource group and so the location that resources
are in can be determined by fetching the information from the existing
group.

It is forbidden to pass both variables as it is easier and more
intuitive that the location comes from the group rather than ignore a
parameter.

Closes: #5655
2017-12-04 11:22:54 +11:00

36 lines
888 B
Go

package arm
import (
"testing"
"github.com/hashicorp/packer/builder/azure/common/constants"
)
func TestStateBagShouldBePopulatedExpectedValues(t *testing.T) {
var testSubject = &Builder{}
_, err := testSubject.Prepare(getArmBuilderConfiguration(), getPackerConfiguration())
if err != nil {
t.Fatalf("failed to prepare: %s", err)
}
var expectedStateBagKeys = []string{
constants.AuthorizedKey,
constants.PrivateKey,
constants.ArmTags,
constants.ArmComputeName,
constants.ArmDeploymentName,
constants.ArmNicName,
constants.ArmResourceGroupName,
constants.ArmStorageAccountName,
constants.ArmVirtualMachineCaptureParameters,
constants.ArmPublicIPAddressName,
}
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)
}
}
}