-
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.
[ORCA-3486] - Reuse shared Event Orchestration Path logic, add import…
… tests (#509) * ORCA-3486 - add import tests for router/unrouted * ORCA-3486 - add import tests for router, unrouted * reuse severity/event_action validation functions in unrouted/service * reuse variables and extractions schema in router/unrouted * reuse shared conditions schema and mapping functions in router/unrouted/service
- Loading branch information
Showing
7 changed files
with
205 additions
and
237 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
38 changes: 38 additions & 0 deletions
38
pagerduty/import_pagerduty_event_orchestration_path_router_test.go
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package pagerduty | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform" | ||
) | ||
|
||
func TestAccPagerDutyEventOrchestrationPathRouter_import(t *testing.T) { | ||
team := fmt.Sprintf("tf-name-%s", acctest.RandString(5)) | ||
escalationPolicy := fmt.Sprintf("tf-%s", acctest.RandString(5)) | ||
service := fmt.Sprintf("tf-%s", acctest.RandString(5)) | ||
orchestration := fmt.Sprintf("tf-orchestration-%s", acctest.RandString(5)) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckPagerDutyEventOrchestrationRouterDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCheckPagerDutyEventOrchestrationRouterConfigWithMultipleRules(team, escalationPolicy, service, orchestration), | ||
}, | ||
{ | ||
ResourceName: "pagerduty_event_orchestration_router.router", | ||
ImportStateIdFunc: testAccCheckPagerDutyEventOrchestrationPathRouterID, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccCheckPagerDutyEventOrchestrationPathRouterID(s *terraform.State) (string, error) { | ||
return s.RootModule().Resources["pagerduty_event_orchestration.orch"].Primary.ID, nil | ||
} |
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
38 changes: 38 additions & 0 deletions
38
pagerduty/import_pagerduty_event_orchestration_path_unrouted_test.go
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package pagerduty | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform" | ||
) | ||
|
||
func TestAccPagerDutyEventOrchestrationPathUnrouted_import(t *testing.T) { | ||
team := fmt.Sprintf("tf-name-%s", acctest.RandString(5)) | ||
escalationPolicy := fmt.Sprintf("tf-%s", acctest.RandString(5)) | ||
service := fmt.Sprintf("tf-%s", acctest.RandString(5)) | ||
orchestration := fmt.Sprintf("tf-orchestration-%s", acctest.RandString(5)) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckPagerDutyEventOrchestrationPathUnroutedDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCheckPagerDutyEventOrchestrationPathUnroutedWithAllConfig(team, escalationPolicy, service, orchestration), | ||
}, | ||
{ | ||
ResourceName: "pagerduty_event_orchestration_unrouted.unrouted", | ||
ImportStateIdFunc: testAccCheckPagerDutyEventOrchestrationPathUnroutedID, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccCheckPagerDutyEventOrchestrationPathUnroutedID(s *terraform.State) (string, error) { | ||
return s.RootModule().Resources["pagerduty_event_orchestration.orch"].Primary.ID, nil | ||
} |
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
Oops, something went wrong.