Skip to content

Commit

Permalink
Detect 404 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmholmes committed Jul 11, 2024
1 parent 094a5cd commit 9f97941
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -42,7 +43,6 @@ func TestResourceAccessPolicyToken_Basic(t *testing.T) {
randomName := acctest.RandStringFromCharSet(6, acctest.CharSetAlpha)
initialName := fmt.Sprintf("initial-%s", randomName)
initialToken := fmt.Sprintf("token-%s", initialName)
rotationName := fmt.Sprintf("rotation-%s", randomName)
updatedName := fmt.Sprintf("updated-%s", randomName)

resource.Test(t, resource.TestCase{
Expand Down Expand Up @@ -75,6 +75,23 @@ func TestResourceAccessPolicyToken_Basic(t *testing.T) {
resource.TestCheckResourceAttr("grafana_cloud_access_policy_token.test", "expires_at", expiresAt),
),
},
{
Config: testAccCloudAccessPolicyTokenConfigBasic(initialName, "", "us", initialScopes, expiresAt),
PreConfig: func() {
orgID, err := strconv.Atoi(*policy.OrgId)
if err != nil {
t.Fatal(err)
}
client := testutils.Provider.Meta().(*common.Client).GrafanaCloudAPI
_, _, err = client.TokensAPI.DeleteToken(context.Background(), *policyToken.Id).
Region("us").
OrgId(int32(orgID)).
XRequestId("deleting-token").Execute()
if err != nil {
t.Fatalf("error getting cloud access policy: %s", err)
}
},
},
{
Config: testAccCloudAccessPolicyTokenConfigBasic(initialName, "updated", "us", updatedScopes, expiresAt),
Check: resource.ComposeTestCheckFunc(
Expand Down

0 comments on commit 9f97941

Please sign in to comment.