Skip to content

Commit 3a21e4f

Browse files
fix: extend default retry status codes with 412 (#2341)
1 parent 790e07b commit 3a21e4f

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

internal/resources/grafana/resource_folder_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,34 @@ func TestAccFolder_PreventDeletionNested(t *testing.T) {
367367
})
368368
}
369369

370+
func TestAccFolder_RapidCreation(t *testing.T) {
371+
testutils.CheckOSSTestsEnabled(t)
372+
373+
folderCount := 100
374+
375+
var checks []resource.TestCheckFunc
376+
for i := range folderCount {
377+
name := fmt.Sprintf("grafana_folder.rapid.%d", i)
378+
checks = append(checks, resource.TestCheckResourceAttr(name, "title", fmt.Sprintf("Rapid Test Folder %d", i)))
379+
}
380+
381+
resource.ParallelTest(t, resource.TestCase{
382+
ProtoV5ProviderFactories: testutils.ProtoV5ProviderFactories,
383+
Steps: []resource.TestStep{
384+
{
385+
Config: fmt.Sprintf(`
386+
resource "grafana_folder" "rapid" {
387+
count = %[1]d
388+
uid = "rapid_test_${count.index}"
389+
title = "Rapid Test Folder ${count.index}"
390+
}
391+
`, folderCount),
392+
Check: resource.ComposeTestCheckFunc(checks...),
393+
},
394+
},
395+
})
396+
}
397+
370398
// This is a bug in Grafana, not the provider. It was fixed in 9.2.7+ and 9.3.0+, this test will check for regressions
371399
func TestAccFolder_createFromDifferentRoles(t *testing.T) {
372400
testutils.CheckOSSTestsEnabled(t, ">=9.2.7")

pkg/provider/framework_provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ func (c *ProviderConfig) SetDefaults() error {
133133
types.StringValue("429"),
134134
types.StringValue("5xx"),
135135
types.StringValue("401"), // In high load scenarios, Grafana sometimes returns 401s (unable to authenticate the user?)
136+
types.StringValue("412"), // Grafana sometimes returns 412s when creating folders in rapid succession
136137
})
137138
}
138139

0 commit comments

Comments
 (0)