provider/aws: Fix panic from AZs Data Source Test
The `aws_availability_zones` data source test was panicking. This fixes both tests ``` $ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSAvailabilityZones' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/31 15:47:39 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAvailabilityZones -timeout 120m === RUN TestAccAWSAvailabilityZones_basic --- PASS: TestAccAWSAvailabilityZones_basic (12.56s) === RUN TestAccAWSAvailabilityZones_stateFilter --- PASS: TestAccAWSAvailabilityZones_stateFilter (13.59s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 26.187s ```
This commit is contained in:
parent
e81231035c
commit
421b25cacf
|
@ -16,12 +16,12 @@ func dataSourceAwsAvailabilityZones() *schema.Resource {
|
||||||
Read: dataSourceAwsAvailabilityZonesRead,
|
Read: dataSourceAwsAvailabilityZonesRead,
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"names": &schema.Schema{
|
"names": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Schema{Type: schema.TypeString},
|
Elem: &schema.Schema{Type: schema.TypeString},
|
||||||
},
|
},
|
||||||
"state": &schema.Schema{
|
"state": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ValidateFunc: validateStateType,
|
ValidateFunc: validateStateType,
|
||||||
|
@ -40,7 +40,7 @@ func dataSourceAwsAvailabilityZonesRead(d *schema.ResourceData, meta interface{}
|
||||||
|
|
||||||
if v, ok := d.GetOk("state"); ok {
|
if v, ok := d.GetOk("state"); ok {
|
||||||
request.Filters = []*ec2.Filter{
|
request.Filters = []*ec2.Filter{
|
||||||
&ec2.Filter{
|
{
|
||||||
Name: aws.String("state"),
|
Name: aws.String("state"),
|
||||||
Values: []*string{aws.String(v.(string))},
|
Values: []*string{aws.String(v.(string))},
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,13 +16,22 @@ func TestAccAWSAvailabilityZones_basic(t *testing.T) {
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
{
|
||||||
Config: testAccCheckAwsAvailabilityZonesConfig,
|
Config: testAccCheckAwsAvailabilityZonesConfig,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckAwsAvailabilityZonesMeta("data.aws_availability_zones.availability_zones"),
|
testAccCheckAwsAvailabilityZonesMeta("data.aws_availability_zones.availability_zones"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
resource.TestStep{
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestAccAWSAvailabilityZones_stateFilter(t *testing.T) {
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
{
|
||||||
Config: testAccCheckAwsAvailabilityZonesStateConfig,
|
Config: testAccCheckAwsAvailabilityZonesStateConfig,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckAwsAvailabilityZoneState("data.aws_availability_zones.state_filter"),
|
testAccCheckAwsAvailabilityZoneState("data.aws_availability_zones.state_filter"),
|
||||||
|
|
Loading…
Reference in New Issue