Commit 68168569 authored by Peter Leitzen's avatar Peter Leitzen Committed by Sean McGivern

Fix alert serialization when opening incidents

As Sidekiq does not support ActionController::Parameters[1]
we have to convert them to a Hash when scheduling a job.

[1]: https://github.com/mperham/sidekiq/issues/3667
parent 99d94583
...@@ -133,7 +133,7 @@ module Projects ...@@ -133,7 +133,7 @@ module Projects
def process_incident_issues def process_incident_issues
firings.each do |alert| firings.each do |alert|
IncidentManagement::ProcessAlertWorker IncidentManagement::ProcessAlertWorker
.perform_async(project.id, alert) .perform_async(project.id, alert.to_h)
end end
end end
......
...@@ -29,16 +29,18 @@ describe Projects::Prometheus::Alerts::NotifyService do ...@@ -29,16 +29,18 @@ describe Projects::Prometheus::Alerts::NotifyService do
end end
end end
shared_examples 'processes incident issues' do |amount| shared_examples 'processes incident issues', :sidekiq do |amount|
let(:create_incident_service) { spy } let(:create_incident_service) { spy }
it 'processes issues' do it 'processes issues' do
expect(IncidentManagement::ProcessAlertWorker) expect(IncidentManagement::ProcessAlertWorker)
.to receive(:perform_async) .to receive(:perform_async)
.with(project.id, anything) .with(project.id, kind_of(Hash))
.exactly(amount).times .exactly(amount).times
expect(subject).to eq(true) Sidekiq::Testing.inline! do
expect(subject).to eq(true)
end
end 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