Skip to content

Commit 688dde9

Browse files
committed
provider/powerdns: Correct dangling resource check
This fix prevents tests incorrectly reporting dangling resources. It is not sufficient to check just whether or not an error occurred when iterating over the listed resources - checking the bool returned is also required.
1 parent ff8cb72 commit 688dde9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

builtin/providers/powerdns/resource_powerdns_record_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,14 @@ func testAccCheckPDNSRecordDestroy(s *terraform.State) error {
213213
}
214214

215215
client := testAccProvider.Meta().(*Client)
216-
_, err := client.RecordExistsByID(rs.Primary.Attributes["zone"], rs.Primary.ID)
217-
if err == nil {
216+
exists, err := client.RecordExistsByID(rs.Primary.Attributes["zone"], rs.Primary.ID)
217+
if err != nil {
218+
return fmt.Errorf("Error checking if record still exists: %#v", rs.Primary.ID)
219+
}
220+
if exists {
218221
return fmt.Errorf("Record still exists: %#v", rs.Primary.ID)
219222
}
223+
220224
}
221225
return nil
222226
}

0 commit comments

Comments
 (0)