Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address: Schedules can't be deleted when they have open incidents #602

Conversation

imjaroiswebdev
Copy link
Contributor

Address: #567

This update doesn't provide an strict solution to the issue, because unfortunately the Provider shouldn't be closing incidents on its own in an arbitrary fashion. However what it does provide is an error message containing a list with the urls pointing to each incident which needs to be resolved in order of retrying the Schedule destruction after the incidents are been resolved.

Example of error message expected...

Error: Before Removing Schedule "PE1DBNP" You must first resolve the following incidents related with Escalation Policies using this Schedule...
        https://subdomain.pagerduty.com/incidents/Q39V9R9QR34GZ5
        https://subdomain.pagerduty.com/incidents/Q37V9R8lR34GBQ
        .
        .
        .

Test cases introduced...

make testacc TESTARGS="-run TestAccPagerDutySchedule"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccPagerDutySchedule -timeout 120m
?       github.com/terraform-providers/terraform-provider-pagerduty     [no test files]
=== RUN   TestAccPagerDutySchedule_import
--- PASS: TestAccPagerDutySchedule_import (11.89s)
=== RUN   TestAccPagerDutySchedule_Basic
--- PASS: TestAccPagerDutySchedule_Basic (14.98s)
=== RUN   TestAccPagerDutyScheduleWithTeams_Basic
--- PASS: TestAccPagerDutyScheduleWithTeams_Basic (15.12s)
=== RUN   TestAccPagerDutyScheduleWithTeams_EscalationPolicyDependant
--- PASS: TestAccPagerDutyScheduleWithTeams_EscalationPolicyDependant (19.79s)
=== RUN   TestAccPagerDutyScheduleWithTeams_EscalationPolicyDependantWithOpenIncidents
--- PASS: TestAccPagerDutyScheduleWithTeams_EscalationPolicyDependantWithOpenIncidents (28.16s) # 👈 New test case
=== RUN   TestAccPagerDutyScheduleOverflow_Basic
--- PASS: TestAccPagerDutyScheduleOverflow_Basic (13.97s)
=== RUN   TestAccPagerDutySchedule_BasicWeek
--- PASS: TestAccPagerDutySchedule_BasicWeek (13.21s)
=== RUN   TestAccPagerDutySchedule_Multi
--- PASS: TestAccPagerDutySchedule_Multi (13.58s)
PASS
ok      github.com/terraform-providers/terraform-provider-pagerduty/pagerduty   131.184s

Depends on: heimweh/go-pagerduty#109

@imjaroiswebdev imjaroiswebdev force-pushed the issue-567-sched-del-with-open-incidents branch from 4505dab to eb3b99d Compare December 22, 2022 17:51
@imjaroiswebdev imjaroiswebdev marked this pull request as ready for review December 22, 2022 17:52
Copy link
Contributor

@stmcallister stmcallister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 🌮 🎉 Looks good! (assuming the conflicts are resolved 😉 )

@imjaroiswebdev imjaroiswebdev force-pushed the issue-567-sched-del-with-open-incidents branch 2 times, most recently from c523e95 to b58b67e Compare December 24, 2022 01:10
@imjaroiswebdev imjaroiswebdev force-pushed the issue-567-sched-del-with-open-incidents branch from b58b67e to 952b1c3 Compare December 24, 2022 01:11
@imjaroiswebdev imjaroiswebdev merged commit 9be2b34 into PagerDuty:master Dec 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants