Skip to content

Commit

Permalink
Make sure tests don't crash
Browse files Browse the repository at this point in the history
  • Loading branch information
julienduchesne committed Mar 2, 2024
1 parent 8f404d6 commit 696bd73
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ func testAccCloudAccessPolicyTokenCheckExists(rn string, a *gcom.AuthToken) reso

func testAccCloudAccessPolicyCheckDestroy(region string, a *gcom.AuthAccessPolicy) resource.TestCheckFunc {
return func(s *terraform.State) error {
if a == nil {
return nil
}
client := testutils.Provider.Meta().(*common.Client).GrafanaCloudAPI
policy, _, err := client.AccesspoliciesAPI.GetAccessPolicy(context.Background(), *a.Id).Region(region).Execute()
if err == nil && policy.Name != "" {
Expand All @@ -207,6 +210,9 @@ func testAccCloudAccessPolicyCheckDestroy(region string, a *gcom.AuthAccessPolic

func testAccCloudAccessPolicyTokenCheckDestroy(region string, a *gcom.AuthToken) resource.TestCheckFunc {
return func(s *terraform.State) error {
if a == nil {
return nil
}
client := testutils.Provider.Meta().(*common.Client).GrafanaCloudAPI
token, _, err := client.TokensAPI.GetToken(context.Background(), *a.Id).Region(region).Execute()
if err == nil && token.Name != "" {
Expand Down

0 comments on commit 696bd73

Please sign in to comment.