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.
This commit is contained in:
James Nugent 2016-01-28 14:03:33 -05:00
parent ff8cb7270e
commit 688dde9bb9
1 changed files with 6 additions and 2 deletions

View File

@ -213,10 +213,14 @@ func testAccCheckPDNSRecordDestroy(s *terraform.State) error {
}
client := testAccProvider.Meta().(*Client)
_, err := client.RecordExistsByID(rs.Primary.Attributes["zone"], rs.Primary.ID)
if err == nil {
exists, err := client.RecordExistsByID(rs.Primary.Attributes["zone"], rs.Primary.ID)
if err != nil {
return fmt.Errorf("Error checking if record still exists: %#v", rs.Primary.ID)
}
if exists {
return fmt.Errorf("Record still exists: %#v", rs.Primary.ID)
}
}
return nil
}