@@ -192,14 +192,151 @@ func TestAcc_TriggerResource(t *testing.T) {
192
192
})
193
193
})
194
194
195
- t .Run ("trigger with partial baseline_details errors " , func (t * testing.T ) {
195
+ t .Run ("trigger with baseline_details validates " , func (t * testing.T ) {
196
196
resource .Test (t , resource.TestCase {
197
197
PreCheck : testAccPreCheck (t ),
198
198
ProtoV5ProviderFactories : testAccProtoV5MuxServerFactory ,
199
199
Steps : []resource.TestStep {
200
200
{
201
201
Config : testAccConfigBasicTriggerWithBaselineDetailsTest (dataset , name , true , true ),
202
202
ExpectError : regexp .MustCompile (`The argument "offset_minutes" is required, but no definition was found.` ),
203
+ PlanOnly : true ,
204
+ },
205
+ {
206
+ Config : `
207
+ data "honeycombio_query_specification" "test" {
208
+ calculation {
209
+ op = "AVG"
210
+ column = "duration_ms"
211
+ }
212
+
213
+ time_range = 1200
214
+ }
215
+
216
+ resource "honeycombio_trigger" "test" {
217
+ name = "Test trigger with baseline_details errors"
218
+ dataset = "foobar"
219
+
220
+ description = "My nice description"
221
+
222
+ query_json = data.honeycombio_query_specification.test.json
223
+
224
+ threshold {
225
+ op = ">"
226
+ value = 100
227
+ }
228
+
229
+ baseline_details {
230
+ type = "percentage"
231
+ offset_minutes = 1440
232
+ }
233
+
234
+ frequency = 1200
235
+ }` ,
236
+ ExpectError : regexp .MustCompile (`must use a threshold operator of '>=' or '<='` ),
237
+ PlanOnly : true ,
238
+ },
239
+ {
240
+ Config : `
241
+ data "honeycombio_query_specification" "test" {
242
+ calculation {
243
+ op = "AVG"
244
+ column = "duration_ms"
245
+ }
246
+
247
+ time_range = 1200
248
+ }
249
+
250
+ resource "honeycombio_trigger" "test" {
251
+ name = "Test trigger with baseline_details errors"
252
+ dataset = "foobar"
253
+
254
+ description = "My nice description"
255
+
256
+ query_json = data.honeycombio_query_specification.test.json
257
+
258
+ threshold {
259
+ op = ">="
260
+ value = -838
261
+ }
262
+
263
+ baseline_details {
264
+ type = "percentage"
265
+ offset_minutes = 1440
266
+ }
267
+
268
+ frequency = 1200
269
+ }` ,
270
+ ExpectError : regexp .MustCompile (`value greater than or equal to 0` ),
271
+ PlanOnly : true ,
272
+ },
273
+ {
274
+ Config : `
275
+ data "honeycombio_query_specification" "test" {
276
+ calculation {
277
+ op = "AVG"
278
+ column = "duration_ms"
279
+ }
280
+
281
+ time_range = 1200
282
+ }
283
+
284
+ resource "honeycombio_trigger" "test" {
285
+ name = "Test trigger with baseline_details errors"
286
+ dataset = "foobar"
287
+
288
+ description = "My nice description"
289
+
290
+ query_json = data.honeycombio_query_specification.test.json
291
+
292
+ threshold {
293
+ op = "<"
294
+ value = 100
295
+ }
296
+
297
+ baseline_details {
298
+ type = "percentage"
299
+ offset_minutes = 1440
300
+ }
301
+
302
+ frequency = 1200
303
+ }` ,
304
+ ExpectError : regexp .MustCompile (`must use a threshold operator of '>=' or '<='` ),
305
+ PlanOnly : true ,
306
+ },
307
+ {
308
+ Config : `
309
+ data "honeycombio_query_specification" "test" {
310
+ calculation {
311
+ op = "AVG"
312
+ column = "duration_ms"
313
+ }
314
+
315
+ time_range = 1200
316
+ }
317
+
318
+ resource "honeycombio_trigger" "test" {
319
+ name = "Test trigger with baseline_details errors"
320
+ dataset = "foobar"
321
+
322
+ description = "My nice description"
323
+
324
+ query_json = data.honeycombio_query_specification.test.json
325
+
326
+ threshold {
327
+ op = "<="
328
+ value = 100
329
+ }
330
+
331
+ baseline_details {
332
+ type = "percentage"
333
+ offset_minutes = 1440
334
+ }
335
+
336
+ frequency = 1200
337
+ }` ,
338
+ ExpectError : regexp .MustCompile (`value less than or equal to 0` ),
339
+ PlanOnly : true ,
203
340
},
204
341
},
205
342
})
0 commit comments