Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky config generation test #1642

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pkg/generate/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@ func TestAccGenerate(t *testing.T) {
require.NoError(t, err)
return string(content)
}(),
generateConfig: func(cfg *generate.Config) {
// The alerting rule group sometimes also creates an annotation.
// It seems to be async so it makes the test flaky.
// We can include only the resources we care about to avoid this.x
cfg.IncludeResources = []string{
"grafana_contact_point.*",
"grafana_folder.*",
"grafana_message_template.*",
"grafana_mute_timing.*",
"grafana_notification_policy.*",
"grafana_organization.*",
"grafana_rule_group.*",
}
},
check: func(t *testing.T, tempDir string) {
assertFiles(t, tempDir, "testdata/generate/alerting-in-org", []string{
".terraform",
Expand Down
10 changes: 0 additions & 10 deletions pkg/generate/testdata/generate/alerting-in-org/imports.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ import {
id = "2"
}

import {
to = grafana_organization_preferences._1
id = "1"
}

import {
to = grafana_organization_preferences._2
id = "2"
}

import {
to = grafana_rule_group._2_alert-rule-folder_My_Rule_Group
id = "2:alert-rule-folder:My Rule Group"
Expand Down
9 changes: 0 additions & 9 deletions pkg/generate/testdata/generate/alerting-in-org/resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ resource "grafana_organization" "_2" {
name = "alerting-org"
}

# __generated__ by Terraform from "1"
resource "grafana_organization_preferences" "_1" {
}

# __generated__ by Terraform from "2"
resource "grafana_organization_preferences" "_2" {
org_id = grafana_organization._2.id
}

# __generated__ by Terraform from "2:alert-rule-folder:My Rule Group"
resource "grafana_rule_group" "_2_alert-rule-folder_My_Rule_Group" {
disable_provenance = false
Expand Down
Loading