From 35e3731a3e65a8feb6912b5ca82b56551b81dc41 Mon Sep 17 00:00:00 2001 From: Sander Blue Date: Thu, 3 Sep 2020 11:09:15 -0500 Subject: [PATCH 1/2] fix(nrql_alert_condition): add missing zeros to violation_time_limit_seconds to the new:old map --- newrelic/structures_newrelic_nrql_alert_condition.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/newrelic/structures_newrelic_nrql_alert_condition.go b/newrelic/structures_newrelic_nrql_alert_condition.go index cb80df52a..e27d90343 100644 --- a/newrelic/structures_newrelic_nrql_alert_condition.go +++ b/newrelic/structures_newrelic_nrql_alert_condition.go @@ -36,10 +36,10 @@ var ( violationTimeLimitMapNewOld = map[alerts.NrqlConditionViolationTimeLimit]int{ alerts.NrqlConditionViolationTimeLimits.OneHour: 3600, alerts.NrqlConditionViolationTimeLimits.TwoHours: 7200, - alerts.NrqlConditionViolationTimeLimits.FourHours: 1440, - alerts.NrqlConditionViolationTimeLimits.EightHours: 2880, - alerts.NrqlConditionViolationTimeLimits.TwelveHours: 4320, - alerts.NrqlConditionViolationTimeLimits.TwentyFourHours: 8640, + alerts.NrqlConditionViolationTimeLimits.FourHours: 14400, + alerts.NrqlConditionViolationTimeLimits.EightHours: 28800, + alerts.NrqlConditionViolationTimeLimits.TwelveHours: 43200, + alerts.NrqlConditionViolationTimeLimits.TwentyFourHours: 86400, } ) From 529852bf558cb268fabcf3488099607eb89934f8 Mon Sep 17 00:00:00 2001 From: Sander Blue Date: Thu, 3 Sep 2020 11:33:58 -0500 Subject: [PATCH 2/2] chore(nrql_alert_condition): update tests to account for violation_time_limit value that caused the previous bug --- newrelic/resource_newrelic_nrql_alert_condition_test.go | 2 +- newrelic/structures_newrelic_nrql_alert_condition_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/newrelic/resource_newrelic_nrql_alert_condition_test.go b/newrelic/resource_newrelic_nrql_alert_condition_test.go index 2f5d6d5f7..f1545cefd 100644 --- a/newrelic/resource_newrelic_nrql_alert_condition_test.go +++ b/newrelic/resource_newrelic_nrql_alert_condition_test.go @@ -476,7 +476,7 @@ resource "newrelic_nrql_alert_condition" "foo" { time_function = "any" } - violation_time_limit_seconds = 3600 + violation_time_limit_seconds = 86400 %[5]s } diff --git a/newrelic/structures_newrelic_nrql_alert_condition_test.go b/newrelic/structures_newrelic_nrql_alert_condition_test.go index b65b514ba..5b00e65e9 100644 --- a/newrelic/structures_newrelic_nrql_alert_condition_test.go +++ b/newrelic/structures_newrelic_nrql_alert_condition_test.go @@ -62,14 +62,14 @@ func TestExpandNrqlAlertConditionInput(t *testing.T) { ExpectReason: "", Expanded: expectedNrql, }, - "basline condition, requires baseline_direction attr": { + "baseline condition, requires baseline_direction attr": { Data: map[string]interface{}{ "type": "baseline", }, ExpectErr: true, ExpectReason: "attribute `baseline_direction` is required for nrql alert conditions of type `baseline`", }, - "basline condition, has baseline_direction attr": { + "baseline condition, has baseline_direction attr": { Data: map[string]interface{}{ "nrql": []interface{}{nrql}, "type": "baseline",