update A and CNAME data tests to ensure id is set
This commit is contained in:
parent
c732c3b16f
commit
af64080153
|
@ -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{
|
||||
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(fmt.Sprintf("data.dns_a_record_set.%s", test.DataSourceName), "addrs", test.Expected),
|
||||
testCheckAttrStringArray(recordName, "addrs", test.Expected),
|
||||
),
|
||||
}
|
||||
steps = append(steps, ts)
|
||||
},
|
||||
resource.TestStep{
|
||||
Config: test.DataSourceBlock,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(recordName, "id", test.Host),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
Providers: testAccProviders,
|
||||
Steps: steps,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue