Skip to content

Commit

Permalink
Cloud: More test fixes (#1569)
Browse files Browse the repository at this point in the history
- Remove deprecated cloud plugin format from tests
- Longer wait timeout for new stacks. It can take longer than a minute or two to have an available stack
  • Loading branch information
julienduchesne committed May 14, 2024
1 parent 9bb8e44 commit 3e2cef5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
7 changes: 0 additions & 7 deletions internal/resources/cloud/resource_cloud_plugin_test.go
Expand Up @@ -41,13 +41,6 @@ func TestAccResourcePluginInstallation(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
},
// Import with different ID formats (Legacy and current)
{
ResourceName: "grafana_cloud_plugin_installation.test-installation",
ImportState: true,
ImportStateVerify: true,
ImportStateId: fmt.Sprintf("%s_%s", stackSlug, pluginSlug),
},
{
ResourceName: "grafana_cloud_plugin_installation.test-installation",
ImportState: true,
Expand Down
Expand Up @@ -81,7 +81,7 @@ Required access policy scopes:
}

func createStackServiceAccount(ctx context.Context, d *schema.ResourceData, cloudClient *gcom.APIClient) diag.Diagnostics {
if err := waitForStackReadinessFromSlug(ctx, 1*time.Minute, d.Get("stack_slug").(string), cloudClient); err != nil {
if err := waitForStackReadinessFromSlug(ctx, 5*time.Minute, d.Get("stack_slug").(string), cloudClient); err != nil {
return err
}

Expand Down Expand Up @@ -117,7 +117,7 @@ func readStackServiceAccount(ctx context.Context, d *schema.ResourceData, cloudC
stackSlug, serviceAccountID = split[0].(string), split[1].(int64)
}

if err := waitForStackReadinessFromSlug(ctx, 1*time.Minute, stackSlug, cloudClient); err != nil {
if err := waitForStackReadinessFromSlug(ctx, 5*time.Minute, stackSlug, cloudClient); err != nil {
return err
}

Expand All @@ -140,7 +140,7 @@ func readStackServiceAccount(ctx context.Context, d *schema.ResourceData, cloudC
}

func deleteStackServiceAccount(ctx context.Context, d *schema.ResourceData, cloudClient *gcom.APIClient) diag.Diagnostics {
if err := waitForStackReadinessFromSlug(ctx, 1*time.Minute, d.Get("stack_slug").(string), cloudClient); err != nil {
if err := waitForStackReadinessFromSlug(ctx, 5*time.Minute, d.Get("stack_slug").(string), cloudClient); err != nil {
return err
}

Expand Down
Expand Up @@ -82,7 +82,7 @@ Required access policy scopes:
}

func stackServiceAccountTokenCreate(ctx context.Context, d *schema.ResourceData, cloudClient *gcom.APIClient) diag.Diagnostics {
if err := waitForStackReadinessFromSlug(ctx, 1*time.Minute, d.Get("stack_slug").(string), cloudClient); err != nil {
if err := waitForStackReadinessFromSlug(ctx, 5*time.Minute, d.Get("stack_slug").(string), cloudClient); err != nil {
return err
}

Expand Down Expand Up @@ -122,7 +122,7 @@ func stackServiceAccountTokenRead(ctx context.Context, d *schema.ResourceData, c
return diag.FromErr(err)
}

if err := waitForStackReadinessFromSlug(ctx, 1*time.Minute, stackSlug, cloudClient); err != nil {
if err := waitForStackReadinessFromSlug(ctx, 5*time.Minute, stackSlug, cloudClient); err != nil {
return err
}

Expand Down Expand Up @@ -161,7 +161,7 @@ func stackServiceAccountTokenRead(ctx context.Context, d *schema.ResourceData, c
}

func stackServiceAccountTokenDelete(ctx context.Context, d *schema.ResourceData, cloudClient *gcom.APIClient) diag.Diagnostics {
if err := waitForStackReadinessFromSlug(ctx, 1*time.Minute, d.Get("stack_slug").(string), cloudClient); err != nil {
if err := waitForStackReadinessFromSlug(ctx, 5*time.Minute, d.Get("stack_slug").(string), cloudClient); err != nil {
return err
}

Expand Down

0 comments on commit 3e2cef5

Please sign in to comment.