Skip to content

Commit

Permalink
Add tests for global and service orchs
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonwarner-pd committed Jul 8, 2024
1 parent 091e8fa commit 09b6b9d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func TestAccPagerDutyEventOrchestrationPathGlobal_Basic(t *testing.T) {
Config: testAccCheckPagerDutyEventOrchestrationGlobalDefaultConfig(team, escalationPolicy, service, orch),
Check: resource.ComposeTestCheckFunc(baseChecks...),
},
{
Config: testAccCheckPagerDutyEventOrchestrationGlobalDefaultWithEscalationPolicy(team, escalationPolicy, service, orch),
Check: resource.ComposeTestCheckFunc(baseChecks...),
},

// Adding/updating/deleting automation_action properties
{
Expand Down Expand Up @@ -277,7 +281,7 @@ func createBaseGlobalOrchConfig(t, ep, s, o string) string {
`, t, ep, s, o)
}

func testAccCheckPagerDutyEventOrchestrationGlobalDefaultConfigDefaultConfig(t, ep, s, o string) string {
func testAccCheckPagerDutyEventOrchestrationGlobalDefaultConfig(t, ep, s, o string) string {
return fmt.Sprintf("%s%s", createBaseGlobalOrchConfig(t, ep, s, o),
`resource "pagerduty_event_orchestration_global" "my_global_orch" {
event_orchestration = pagerduty_event_orchestration.orch.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func TestAccPagerDutyEventOrchestrationPathService_Basic(t *testing.T) {
Config: testAccCheckPagerDutyEventOrchestrationPathServiceDefaultConfig(escalationPolicy, service),
Check: resource.ComposeTestCheckFunc(baseChecks...),
},
{
Config: testAccCheckPagerDutyEventOrchestrationServiceEscalationPolicy(escalationPolicy, service),
Check: resource.ComposeTestCheckFunc(baseChecks...),
},
// Adding/updating/deleting automation_action properties
{
Config: testAccCheckPagerDutyEventOrchestrationPathServiceAutomationActionsConfig(escalationPolicy, service),
Expand Down Expand Up @@ -341,6 +345,31 @@ func createBaseServicePathConfig(ep, s string) string {
`, ep, s)
}

func testAccCheckPagerDutyEventOrchestrationServiceEscalationPolicy(ep, s string) string {
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
set {
id = "start"
}
catch_all {
actions { }
}
set {
id = "start"
rule {
label = "rule 1"
actions {
"escalation_policy": "POLICY"
}
}
}
}
`)
}

func testAccCheckPagerDutyEventOrchestrationPathServiceDefaultConfig(ep, s string) string {
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
Expand Down

0 comments on commit 09b6b9d

Please sign in to comment.