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

Improve resource/pagerduty_schedule open incidents handling on deletion #681

Conversation

imjaroiswebdev
Copy link
Contributor

Complements #679

Some users where reporting that the inclusion of UserIDs as an additional query param for targeting the incidents was generating error on the retries for listing open incidents. So, this update is addressing that issue.

Additionally, I took the chance for moving the incident query to happen when a 400 error is received and it's also containing an expected message, to make the call for the open incidents, which turns out to be more efficient than making the call each time a Schedule was trying to be deleted.

Finally, I extended the test case covering the case when an unrelated incident get created and assigned to the same user in the Schedule that's going to be deleted, but the user received the incident assignment because of a different Escalation Policy, and this latter is not using the above mentioned Schedule.

Test cases extended...

$ 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 (12.50s)
=== RUN   TestAccPagerDutySchedule_Basic
--- PASS: TestAccPagerDutySchedule_Basic (15.48s)
=== RUN   TestAccPagerDutyScheduleWithTeams_Basic
--- PASS: TestAccPagerDutyScheduleWithTeams_Basic (16.05s)
=== RUN   TestAccPagerDutySchedule_BasicWithExternalDestroyHandling
--- PASS: TestAccPagerDutySchedule_BasicWithExternalDestroyHandling (12.86s)
=== RUN   TestAccPagerDutyScheduleWithTeams_EscalationPolicyDependant
--- PASS: TestAccPagerDutyScheduleWithTeams_EscalationPolicyDependant (17.81s)
=== RUN   TestAccPagerDutyScheduleWithTeams_EscalationPolicyDependantWithOpenIncidents
--- PASS: TestAccPagerDutyScheduleWithTeams_EscalationPolicyDependantWithOpenIncidents (50.52s)
=== RUN   TestAccPagerDutySchedule_EscalationPolicyDependantWithOpenIncidents # 👈 Test case extended
--- PASS: TestAccPagerDutySchedule_EscalationPolicyDependantWithOpenIncidents (51.28s)
=== RUN   TestAccPagerDutyScheduleOverflow_Basic
--- PASS: TestAccPagerDutyScheduleOverflow_Basic (15.35s)
=== RUN   TestAccPagerDutySchedule_BasicWeek
--- PASS: TestAccPagerDutySchedule_BasicWeek (14.95s)
=== RUN   TestAccPagerDutySchedule_Multi
--- PASS: TestAccPagerDutySchedule_Multi (15.26s)
PASS
ok      github.com/terraform-providers/terraform-provider-pagerduty/pagerduty   222.583s

@imjaroiswebdev imjaroiswebdev merged commit ee0f0b4 into PagerDuty:master May 3, 2023
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.

1 participant