Skip to content

Commit

Permalink
Defer closing bigtable client in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rileykarson committed Oct 23, 2018
1 parent 7acbfa3 commit f4afb91
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions provider/terraform/tests/resource_bigtable_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ func testAccCheckBigtableInstanceDestroy(s *terraform.State) error {
return fmt.Errorf("Error starting instance admin client. %s", err)
}

defer c.Close()

_, err = c.InstanceInfo(ctx, rs.Primary.Attributes["name"])
if err == nil {
return fmt.Errorf("Instance %s still exists.", rs.Primary.Attributes["name"])
}

c.Close()
}

return nil
Expand All @@ -114,13 +114,13 @@ func testAccBigtableInstanceExists(n string) resource.TestCheckFunc {
return fmt.Errorf("Error starting instance admin client. %s", err)
}

defer c.Close()

_, err = c.InstanceInfo(ctx, rs.Primary.Attributes["name"])
if err != nil {
return fmt.Errorf("Error retrieving instance %s.", rs.Primary.Attributes["name"])
}

c.Close()

return nil
}
}
Expand Down

0 comments on commit f4afb91

Please sign in to comment.