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 7c6ba8a33..9209b5f5c 100644 --- a/builtin/providers/dns/data_dns_a_record_set_test.go +++ b/builtin/providers/dns/data_dns_a_record_set_test.go @@ -12,6 +12,7 @@ func TestAccDataDnsARecordSet_Basic(t *testing.T) { DataSourceBlock string DataSourceName string Expected []string + Host string }{ { ` @@ -23,6 +24,7 @@ func TestAccDataDnsARecordSet_Basic(t *testing.T) { []string{ "127.0.0.1", }, + "127.0.0.1.nip.io", }, { ` @@ -34,23 +36,30 @@ func TestAccDataDnsARecordSet_Basic(t *testing.T) { []string{ "129.6.15.30", }, + "time-c.nist.gov", }, } - var steps []resource.TestStep - for _, test := range tests { - 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) + recordName := fmt.Sprintf("data.dns_a_record_set.%s", test.DataSourceName) + + resource.UnitTest(t, resource.TestCase{ + Providers: testAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: test.DataSourceBlock, + Check: resource.ComposeTestCheckFunc( + testCheckAttrStringArray(recordName, "addrs", test.Expected), + ), + }, + resource.TestStep{ + Config: test.DataSourceBlock, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(recordName, "id", test.Host), + ), + }, + }, + }) } - resource.Test(t, resource.TestCase{ - Providers: testAccProviders, - Steps: steps, - }) } diff --git a/builtin/providers/dns/data_dns_cname_record_set_test.go b/builtin/providers/dns/data_dns_cname_record_set_test.go index 3ae2fdbc5..21e8eeb77 100644 --- a/builtin/providers/dns/data_dns_cname_record_set_test.go +++ b/builtin/providers/dns/data_dns_cname_record_set_test.go @@ -10,6 +10,7 @@ func TestAccDnsCnameRecordSet_Basic(t *testing.T) { tests := []struct { DataSourceBlock string Expected string + Host string }{ { ` @@ -18,6 +19,7 @@ func TestAccDnsCnameRecordSet_Basic(t *testing.T) { } `, "dualstack.s.shared.global.fastly.net.", + "www.hashicorp.com", }, } @@ -31,6 +33,12 @@ func TestAccDnsCnameRecordSet_Basic(t *testing.T) { r.TestCheckResourceAttr("data.dns_cname_record_set.foo", "cname", test.Expected), ), }, + r.TestStep{ + Config: test.DataSourceBlock, + Check: r.ComposeTestCheckFunc( + r.TestCheckResourceAttr("data.dns_cname_record_set.foo", "id", test.Host), + ), + }, }, }) }