From 983e041dc1fd77c12ae42fdb394e427f22f41527 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 17 Mar 2017 12:02:40 -0400 Subject: [PATCH] Convert dns data tests to acceptance tests These call out to external resources and can fail in unit tests. --- .../dns/data_dns_a_record_set_test.go | 29 ++++++++++--------- .../dns/resource_dns_a_record_set_test.go | 2 +- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/builtin/providers/dns/data_dns_a_record_set_test.go b/builtin/providers/dns/data_dns_a_record_set_test.go index 2052294c1..7c6ba8a33 100644 --- a/builtin/providers/dns/data_dns_a_record_set_test.go +++ b/builtin/providers/dns/data_dns_a_record_set_test.go @@ -4,10 +4,10 @@ import ( "fmt" "testing" - r "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/helper/resource" ) -func TestAccDnsARecordSet_Basic(t *testing.T) { +func TestAccDataDnsARecordSet_Basic(t *testing.T) { tests := []struct { DataSourceBlock string DataSourceName string @@ -37,17 +37,20 @@ func TestAccDnsARecordSet_Basic(t *testing.T) { }, } + var steps []resource.TestStep + for _, test := range tests { - r.UnitTest(t, r.TestCase{ - Providers: testAccProviders, - Steps: []r.TestStep{ - r.TestStep{ - Config: test.DataSourceBlock, - Check: r.ComposeTestCheckFunc( - testCheckAttrStringArray(fmt.Sprintf("data.dns_a_record_set.%s", test.DataSourceName), "addrs", test.Expected), - ), - }, - }, - }) + ts := resource.TestStep{ + Config: test.DataSourceBlock, + Check: resource.ComposeTestCheckFunc( + testCheckAttrStringArray(fmt.Sprintf("data.dns_a_record_set.%s", test.DataSourceName), "addrs", test.Expected), + ), + } + steps = append(steps, ts) } + + resource.Test(t, resource.TestCase{ + Providers: testAccProviders, + Steps: steps, + }) } diff --git a/builtin/providers/dns/resource_dns_a_record_set_test.go b/builtin/providers/dns/resource_dns_a_record_set_test.go index 5eb632e42..45fc1a525 100644 --- a/builtin/providers/dns/resource_dns_a_record_set_test.go +++ b/builtin/providers/dns/resource_dns_a_record_set_test.go @@ -10,7 +10,7 @@ import ( "github.com/miekg/dns" ) -func TestAccDnsARecordSet_basic(t *testing.T) { +func TestAccDnsARecordSet_Basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) },