Skip to content

Commit

Permalink
Migrate resource service
Browse files Browse the repository at this point in the history
Using protocol v5
Add validation to require support_hours when incident_urgency_rule is "use_support_hours"
Improve pagerduty_service testing
Add validations for pagerduty_service properties inside blocks
  • Loading branch information
cjgajard committed May 3, 2024
1 parent 1129196 commit f213df9
Show file tree
Hide file tree
Showing 24 changed files with 4,512 additions and 674 deletions.
659 changes: 0 additions & 659 deletions pagerduty/resource_pagerduty_service_test.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ func TestAccPagerDutyService_import(t *testing.T) {
service := fmt.Sprintf("tf-%s", acctest.RandString(5))

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckPagerDutyServiceDestroy,
PreCheck: func() { testAccPreCheck(t) },
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories(),
CheckDestroy: testAccCheckPagerDutyServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckPagerDutyServiceConfig(username, email, escalationPolicy, service),
Expand All @@ -32,16 +32,16 @@ func TestAccPagerDutyService_import(t *testing.T) {
})
}

func TestAccPagerDutyServiceWithIncidentUrgency_import(t *testing.T) {
func TestAccPagerDutyService_import_WithIncidentUrgency(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,
PreCheck: func() { testAccPreCheck(t) },
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories(),
CheckDestroy: testAccCheckPagerDutyServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckPagerDutyServiceWithIncidentUrgencyRulesConfig(username, email, escalationPolicy, service),
Expand All @@ -56,16 +56,16 @@ func TestAccPagerDutyServiceWithIncidentUrgency_import(t *testing.T) {
})
}

func TestAccPagerDutyServiceWithAlertGroupingParameters_import(t *testing.T) {
func TestAccPagerDutyService_import_WithAlertGroupingParameters(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,
PreCheck: func() { testAccPreCheck(t) },
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories(),
CheckDestroy: testAccCheckPagerDutyServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckPagerDutyServiceConfigWithAlertContentGrouping(username, email, escalationPolicy, service),
Expand All @@ -88,16 +88,16 @@ func TestAccPagerDutyServiceWithAlertGroupingParameters_import(t *testing.T) {
})
}

func TestAccPagerDutyServiceWithAutoPauseNotifications_import(t *testing.T) {
func TestAccPagerDutyService_import_WithAutoPauseNotifications(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,
PreCheck: func() { testAccPreCheck(t) },
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories(),
CheckDestroy: testAccCheckPagerDutyServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckPagerDutyServiceConfigWithAutoPauseNotificationsParameters(username, email, escalationPolicy, service),
Expand Down
1 change: 1 addition & 0 deletions pagerdutyplugin/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func (p *Provider) Resources(_ context.Context) [](func() resource.Resource) {
func() resource.Resource { return &resourceBusinessService{} },
func() resource.Resource { return &resourceExtensionServiceNow{} },
func() resource.Resource { return &resourceExtension{} },
func() resource.Resource { return &resourceService{} },
func() resource.Resource { return &resourceTagAssignment{} },
func() resource.Resource { return &resourceTag{} },
}
Expand Down
Loading

0 comments on commit f213df9

Please sign in to comment.