Clean up pending escalations after moving incident to new project
What does this MR do and why?
This handles when an Incident Issue is moved to a new project.
- Removes any pending escalation records
A new escalation status is created on the new Issue (in the new project) by the existing process.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
- Create an Incident Issue via GDK
- Create an Escalation Policy + rules
- Create the pending escalations like so:
incident = Issue.incident.last
policy = incident.project.incident_management_escalation_policies.first
# Create pending escalations
rules = policy.active_rules
rules.map do |rule|
IncidentManagement::PendingEscalations::Issue.create!(
target: incident,
rule: rule,
process_at: rule.elapsed_time_seconds.seconds.after(Time.current)
)
end
- Check that the pending escalations and escalation status exist
incident.pending_escalations.count
incident.incident_management_issuable_escalation_status
- Move the isuse
- Check that pending escalations are removed
incident.pending_escalations.count
- Ensure the newwly created incident has the escalation status
Issue.incident.last.incident_management_issuable_escalation_status
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #330281 (closed)
Edited by Sean Arnold