Commit 3d08bfcd authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'pl-sla-supported' into 'master'

Do not apply SLA labels when issuable does not support it

See merge request gitlab-org/gitlab!49381
parents b412362c 74b6309f
......@@ -9,9 +9,10 @@ module IncidentManagement
def perform(incident_id)
@incident = Issue.find_by_id(incident_id)
@project = incident&.project
return unless incident&.supports_severity?
return unless incident && project
@project = incident&.project
return unless project
@label = incident_exceeded_sla_label
return if incident.label_ids.include?(label.id)
......
......@@ -39,4 +39,15 @@ RSpec.describe IncidentManagement::ApplyIncidentSlaExceededLabelWorker do
expect(event.action).to eq('add')
expect(event.label).to eq(label)
end
context 'for plain issues' do
before_all do
incident.update!(issue_type: 'issue')
end
it 'does not add a label', :aggregate_failures do
expect { subject }.not_to change { incident.labels.reload.count }
expect(incident.labels.reload).to be_empty
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment