From 688dde9bb9078da46e46555d96248310916e37db Mon Sep 17 00:00:00 2001 From: James Nugent Date: Thu, 28 Jan 2016 14:03:33 -0500 Subject: [PATCH] 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. --- .../providers/powerdns/resource_powerdns_record_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/builtin/providers/powerdns/resource_powerdns_record_test.go b/builtin/providers/powerdns/resource_powerdns_record_test.go index 92fbc3c1e..44831f263 100644 --- a/builtin/providers/powerdns/resource_powerdns_record_test.go +++ b/builtin/providers/powerdns/resource_powerdns_record_test.go @@ -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 }