Skip to content

Commit 5a3eedd

Browse files
committed
* Add type to client
* Fix up missing fields
1 parent 97e2534 commit 5a3eedd

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

internal/clients/kibana/slo.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ func responseIndicatorToCreateSloRequestIndicator(s slo.SloResponseIndicator) (s
156156
case *slo.IndicatorPropertiesHistogram:
157157
ret.IndicatorPropertiesHistogram = ind
158158

159+
case *slo.IndicatorPropertiesTimesliceMetric:
160+
ret.IndicatorPropertiesTimesliceMetric = ind
161+
159162
default:
160163
return ret, fmt.Errorf("unknown indicator type: %T", ind)
161164
}

internal/kibana/slo_test.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,16 @@ func TestAccResourceSlo_timeslice_metric_indicator_basic(t *testing.T) {
279279
threshold = 100
280280
}
281281
}
282+
budgeting_method = "timeslices"
283+
objective {
284+
target = 0.95
285+
timeslice_target = 0.95
286+
timeslice_window = "5m"
287+
}
288+
time_window {
289+
duration = "7d"
290+
type = "rolling"
291+
}
282292
}
283293
`, sloName),
284294
Check: resource.ComposeTestCheckFunc(
@@ -317,6 +327,16 @@ func TestAccResourceSlo_timeslice_metric_indicator_percentile(t *testing.T) {
317327
threshold = 200
318328
}
319329
}
330+
budgeting_method = "timeslices"
331+
objective {
332+
target = 0.95
333+
timeslice_target = 0.95
334+
timeslice_window = "5m"
335+
}
336+
time_window {
337+
duration = "7d"
338+
type = "rolling"
339+
}
320340
}
321341
`, sloName),
322342
Check: resource.ComposeTestCheckFunc(
@@ -353,6 +373,16 @@ func TestAccResourceSlo_timeslice_metric_indicator_doc_count(t *testing.T) {
353373
threshold = 10
354374
}
355375
}
376+
budgeting_method = "timeslices"
377+
objective {
378+
target = 0.95
379+
timeslice_target = 0.95
380+
timeslice_window = "5m"
381+
}
382+
time_window {
383+
duration = "7d"
384+
type = "rolling"
385+
}
356386
}
357387
`, sloName),
358388
Check: resource.ComposeTestCheckFunc(
@@ -389,6 +419,16 @@ func TestAccResourceSlo_timeslice_metric_indicator_mismatched_equation(t *testin
389419
threshold = 100
390420
}
391421
}
422+
budgeting_method = "timeslices"
423+
objective {
424+
target = 0.95
425+
timeslice_target = 0.95
426+
timeslice_window = "5m"
427+
}
428+
time_window {
429+
duration = "7d"
430+
type = "rolling"
431+
}
392432
}
393433
`, sloName),
394434
ExpectError: regexp.MustCompile(`.*B.*not defined.*`),
@@ -432,6 +472,16 @@ func TestAccResourceSlo_timeslice_metric_indicator_multiple_mixed_metrics(t *tes
432472
threshold = 100
433473
}
434474
}
475+
budgeting_method = "timeslices"
476+
objective {
477+
target = 0.95
478+
timeslice_target = 0.95
479+
timeslice_window = "5m"
480+
}
481+
time_window {
482+
duration = "7d"
483+
type = "rolling"
484+
}
435485
}
436486
`, sloName),
437487
Check: resource.ComposeTestCheckFunc(

0 commit comments

Comments
 (0)