diff --git a/builder/amazon/common/ami_config_test.go b/builder/amazon/common/ami_config_test.go index 7623d6adb..f7fce7411 100644 --- a/builder/amazon/common/ami_config_test.go +++ b/builder/amazon/common/ami_config_test.go @@ -25,7 +25,6 @@ func getFakeAccessConfig(region string) *AccessConfig { func TestAMIConfigPrepare_name(t *testing.T) { c := testAMIConfig() accessConf := testAccessConfig() - c.AMISkipRegionValidation = true if err := c.Prepare(accessConf, nil); err != nil { t.Fatalf("shouldn't have err: %s", err) } @@ -53,7 +52,6 @@ func (m *mockEC2Client) DescribeRegions(*ec2.DescribeRegionsInput) (*ec2.Describ func TestAMIConfigPrepare_regions(t *testing.T) { c := testAMIConfig() c.AMIRegions = nil - c.AMISkipRegionValidation = true var errs []error var err error @@ -63,7 +61,6 @@ func TestAMIConfigPrepare_regions(t *testing.T) { t.Fatalf("shouldn't have err: %#v", errs) } - c.AMISkipRegionValidation = false c.AMIRegions, err = listEC2Regions(mockConn) if err != nil { t.Fatalf("shouldn't have err: %s", err.Error()) @@ -71,11 +68,6 @@ func TestAMIConfigPrepare_regions(t *testing.T) { if errs = c.prepareRegions(accessConf); len(errs) > 0 { t.Fatalf("shouldn't have err: %#v", errs) } - - c.AMIRegions = []string{"foo"} - if errs = c.prepareRegions(accessConf); len(errs) == 0 { - t.Fatal("should have error") - } errs = errs[:0] c.AMIRegions = []string{"us-east-1", "us-west-1", "us-east-1"} @@ -89,11 +81,9 @@ func TestAMIConfigPrepare_regions(t *testing.T) { } c.AMIRegions = []string{"custom"} - c.AMISkipRegionValidation = true if errs = c.prepareRegions(accessConf); len(errs) > 0 { t.Fatal("shouldn't have error") } - c.AMISkipRegionValidation = false c.AMIRegions = []string{"us-east-1", "us-east-2", "us-west-1"} c.AMIRegionKMSKeyIDs = map[string]string{ @@ -142,11 +132,9 @@ func TestAMIConfigPrepare_regions(t *testing.T) { "us-west-1": "789-012-3456", } - c.AMISkipRegionValidation = true if err := c.Prepare(accessConf, nil); err == nil { t.Fatal("should have error b/c theres a region in in ami_regions that isn't in the key map") } - c.AMISkipRegionValidation = false c.SnapshotUsers = []string{"foo", "bar"} c.AMIKmsKeyId = "123-abc-456" @@ -172,7 +160,6 @@ func TestAMIConfigPrepare_regions(t *testing.T) { func TestAMIConfigPrepare_Share_EncryptedBoot(t *testing.T) { c := testAMIConfig() - c.AMISkipRegionValidation = true c.AMIUsers = []string{"testAccountID"} c.AMIEncryptBootVolume = true @@ -191,7 +178,6 @@ func TestAMIConfigPrepare_Share_EncryptedBoot(t *testing.T) { func TestAMINameValidation(t *testing.T) { c := testAMIConfig() - c.AMISkipRegionValidation = true accessConf := testAccessConfig()