@@ -205,21 +205,39 @@ func TestAccNotificationPolicy_disableProvenance(t *testing.T) {
205
205
}
206
206
207
207
func TestAccNotificationPolicy_error (t * testing.T ) {
208
- testutils .CheckOSSTestsEnabled (t , ">=9.1.0" )
208
+ testCases := []struct {
209
+ versionConstraint string
210
+ errorMessage string
211
+ }{
212
+ {
213
+ versionConstraint : ">=9.1.0,<11.4.0" ,
214
+ errorMessage : "400.+invalid object specification: receiver 'invalid' does not exist" ,
215
+ },
216
+ {
217
+ versionConstraint : ">=11.4.0" ,
218
+ errorMessage : "400.+Invalid format of the submitted route: receiver 'invalid' does not exist" ,
219
+ },
220
+ }
209
221
210
- resource .Test (t , resource.TestCase {
211
- ProtoV5ProviderFactories : testutils .ProtoV5ProviderFactories ,
212
- Steps : []resource.TestStep {
213
- {
214
- Config : `resource "grafana_notification_policy" "test" {
222
+ for _ , tc := range testCases {
223
+ t .Run (tc .versionConstraint , func (t * testing.T ) {
224
+ testutils .CheckOSSTestsEnabled (t , tc .versionConstraint )
225
+
226
+ resource .Test (t , resource.TestCase {
227
+ ProtoV5ProviderFactories : testutils .ProtoV5ProviderFactories ,
228
+ Steps : []resource.TestStep {
229
+ {
230
+ Config : `resource "grafana_notification_policy" "test" {
215
231
group_by = ["..."]
216
232
contact_point = "invalid"
217
233
}` ,
218
- // This tests that the API error message is propagated to the user.
219
- ExpectError : regexp .MustCompile ("400.+invalid object specification: receiver 'invalid' does not exist" ),
220
- },
221
- },
222
- })
234
+ // This tests that the API error message is propagated to the user.
235
+ ExpectError : regexp .MustCompile (tc .errorMessage ),
236
+ },
237
+ },
238
+ })
239
+ })
240
+ }
223
241
}
224
242
225
243
func TestAccNotificationPolicy_inOrg (t * testing.T ) {
0 commit comments