Commit 3e645d84 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Mark ProcessAlertWorkerV2 as idempotent

parent f4c1c223
......@@ -1054,7 +1054,7 @@
:urgency: :low
:resource_boundary: :unknown
:weight: 2
:idempotent:
:idempotent: true
:tags: []
- :name: incident_management:incident_management_process_prometheus_alert
:worker_name: IncidentManagement::ProcessPrometheusAlertWorker
......
......@@ -7,6 +7,8 @@ module IncidentManagement
queue_namespace :incident_management
feature_category :incident_management
idempotent!
def perform(alert_id)
return unless alert_id
......
......@@ -42,6 +42,14 @@ RSpec.describe IncidentManagement::ProcessAlertWorkerV2 do
expect(Gitlab::AppLogger).not_to have_received(:warn)
end
it_behaves_like 'an idempotent worker' do
let(:job_args) { [alert.id] }
it 'does not create a second issue' do
expect { perform_worker }.to change { Issue.count }.by(1)
end
end
end
context 'with valid alert' do
......
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