-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for intelligent alert grouping time window
- Loading branch information
1 parent
bea7724
commit 6c46a84
Showing
7 changed files
with
231 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -447,6 +447,51 @@ func TestAccPagerDutyService_AlertContentGrouping(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccPagerDutyService_AlertContentGroupingIntelligentTimeWindow(t *testing.T) { | ||
username := fmt.Sprintf("tf-%s", acctest.RandString(5)) | ||
email := fmt.Sprintf("%[email protected]", username) | ||
escalationPolicy := fmt.Sprintf("tf-%s", acctest.RandString(5)) | ||
service := fmt.Sprintf("tf-%s", acctest.RandString(5)) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckPagerDutyServiceDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCheckPagerDutyServiceConfigWithAlertContentGroupingIntelligentTimeWindow(username, email, escalationPolicy, service), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckPagerDutyServiceExists("pagerduty_service.foo"), | ||
resource.TestCheckResourceAttr( | ||
"pagerduty_service.foo", "name", service), | ||
resource.TestCheckResourceAttr( | ||
"pagerduty_service.foo", "description", "foo"), | ||
resource.TestCheckResourceAttr( | ||
"pagerduty_service.foo", "alert_creation", "create_alerts_and_incidents"), | ||
resource.TestCheckResourceAttr( | ||
"pagerduty_service.foo", "alert_grouping_parameters.0.type", "intelligent"), | ||
), | ||
}, | ||
{ | ||
Config: testAccCheckPagerDutyServiceConfigWithAlertContentGroupingIntelligentTimeWindowUpdated(username, email, escalationPolicy, service), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckPagerDutyServiceExists("pagerduty_service.foo"), | ||
resource.TestCheckResourceAttr( | ||
"pagerduty_service.foo", "name", service), | ||
resource.TestCheckResourceAttr( | ||
"pagerduty_service.foo", "description", "foo"), | ||
resource.TestCheckResourceAttr( | ||
"pagerduty_service.foo", "alert_creation", "create_alerts_and_incidents"), | ||
resource.TestCheckResourceAttr( | ||
"pagerduty_service.foo", "alert_grouping_parameters.0.type", "intelligent"), | ||
resource.TestCheckResourceAttr( | ||
"pagerduty_service.foo", "alert_grouping_parameters.0.config.0.time_window", "900"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccPagerDutyService_AutoPauseNotificationsParameters(t *testing.T) { | ||
username := fmt.Sprintf("tf-%s", acctest.RandString(5)) | ||
email := fmt.Sprintf("%[email protected]", username) | ||
|
@@ -1170,6 +1215,84 @@ resource "pagerduty_service" "foo" { | |
`, username, email, escalationPolicy, service) | ||
} | ||
|
||
func testAccCheckPagerDutyServiceConfigWithAlertContentGroupingIntelligentTimeWindow(username, email, escalationPolicy, service string) string { | ||
return fmt.Sprintf(` | ||
resource "pagerduty_user" "foo" { | ||
name = "%s" | ||
email = "%s" | ||
color = "green" | ||
role = "user" | ||
job_title = "foo" | ||
description = "foo" | ||
} | ||
resource "pagerduty_escalation_policy" "foo" { | ||
name = "%s" | ||
description = "bar" | ||
num_loops = 2 | ||
rule { | ||
escalation_delay_in_minutes = 10 | ||
target { | ||
type = "user_reference" | ||
id = pagerduty_user.foo.id | ||
} | ||
} | ||
} | ||
resource "pagerduty_service" "foo" { | ||
name = "%s" | ||
description = "foo" | ||
auto_resolve_timeout = 1800 | ||
acknowledgement_timeout = 1800 | ||
escalation_policy = pagerduty_escalation_policy.foo.id | ||
alert_creation = "create_alerts_and_incidents" | ||
alert_grouping_parameters { | ||
type = "intelligent" | ||
} | ||
} | ||
`, username, email, escalationPolicy, service) | ||
} | ||
func testAccCheckPagerDutyServiceConfigWithAlertContentGroupingIntelligentTimeWindowUpdated(username, email, escalationPolicy, service string) string { | ||
return fmt.Sprintf(` | ||
resource "pagerduty_user" "foo" { | ||
name = "%s" | ||
email = "%s" | ||
color = "green" | ||
role = "user" | ||
job_title = "foo" | ||
description = "foo" | ||
} | ||
resource "pagerduty_escalation_policy" "foo" { | ||
name = "%s" | ||
description = "bar" | ||
num_loops = 2 | ||
rule { | ||
escalation_delay_in_minutes = 10 | ||
target { | ||
type = "user_reference" | ||
id = pagerduty_user.foo.id | ||
} | ||
} | ||
} | ||
resource "pagerduty_service" "foo" { | ||
name = "%s" | ||
description = "foo" | ||
auto_resolve_timeout = 1800 | ||
acknowledgement_timeout = 1800 | ||
escalation_policy = pagerduty_escalation_policy.foo.id | ||
alert_creation = "create_alerts_and_incidents" | ||
alert_grouping_parameters { | ||
type = "intelligent" | ||
config { | ||
time_window = 900 | ||
} | ||
} | ||
} | ||
`, username, email, escalationPolicy, service) | ||
} | ||
|
||
func testAccCheckPagerDutyServiceConfigWithAlertContentGroupingUpdated(username, email, escalationPolicy, service string) string { | ||
return fmt.Sprintf(` | ||
resource "pagerduty_user" "foo" { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.