Skip to content

Commit f7e6595

Browse files
author
Piper Dougherty
committed
fix: refactoring deprecated tests
1 parent c4294ce commit f7e6595

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

infoblox/resource_infoblox_zone_delegated_test.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ func testAccZoneDelegatedCompare(t *testing.T, resPath string, expectedRec *ibcl
4141
connector := meta.(ibclient.IBConnector)
4242
objMgr := ibclient.NewObjectManager(connector, "terraform_test", "test")
4343

44-
lookupHosts, err := net.LookupHost(expectedRec.Nameserver)
44+
lookupHosts, err := net.LookupHost(*expectedRec.Nameserver)
4545
if err != nil {
4646
return fmt.Errorf("Failed to resolve delegate_to: %s", err.Error())
4747
}
4848
sort.Strings(lookupHosts)
49-
expectedRec.Addresses = append(expectedRec.Addresses, ibclient.ZoneNameServer{Address: lookupHosts[0]})
49+
expectedRec.Addresses = append(expectedRec.Addresses, &ibclient.ZoneNameServer{Address: lookupHosts[0]})
5050

5151
rec, _ := objMgr.GetZoneDelegated(res.Primary.ID)
5252
if rec == nil {
@@ -63,15 +63,19 @@ func testAccZoneDelegatedCompare(t *testing.T, resPath string, expectedRec *ibcl
6363
"'delegate_to['address']' does not match: got '%s', expected '%s'",
6464
rec.DelegateTo[0].Address, expectedRec.Addresses[0].Address)
6565
}
66-
if rec.DelegateTo[0].Name != expectedRec.Nameserver {
66+
if rec.DelegateTo[0].Name != *expectedRec.Nameserver {
6767
return fmt.Errorf(
6868
"'delegate_to['name']' does not match: got '%s', expected '%s'",
69-
rec.DelegateTo[0].Name, expectedRec.Nameserver)
69+
rec.DelegateTo[0].Name, *expectedRec.Nameserver)
7070
}
7171
return nil
7272
}
7373
}
7474

75+
func strPtr(s string) *string {
76+
return &s
77+
}
78+
7579
func TestAccResourceZoneDelegated(t *testing.T) {
7680
resource.Test(t, resource.TestCase{
7781
PreCheck: func() { testAccPreCheck(t) },
@@ -89,7 +93,7 @@ func TestAccResourceZoneDelegated(t *testing.T) {
8993
Check: resource.ComposeTestCheckFunc(
9094
testAccZoneDelegatedCompare(t, "infoblox_zone_delegated.foo", &ibclient.RecordNS{
9195
Name: "subdomain.test.com",
92-
Nameserver: "ns2.infoblox.com",
96+
Nameserver: strPtr("ns2.infoblox.com"),
9397
}),
9498
),
9599
},

0 commit comments

Comments
 (0)