Commit 38f4988e authored by Peter Leitzen's avatar Peter Leitzen

Merge branch '250264-ignore-end_time-when-generating-automatic-payload' into 'master'

Resolve "Ignore end_time when generating automatic payload"

See merge request gitlab-org/gitlab!42555
parents 041c2ea2 7c99cd22
...@@ -6,7 +6,7 @@ module EE ...@@ -6,7 +6,7 @@ module EE
module NotificationPayloadParser module NotificationPayloadParser
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
EXCLUDED_PAYLOAD_FINGERPRINT_PARAMS = %w(start_time hosts).freeze EXCLUDED_PAYLOAD_FINGERPRINT_PARAMS = %w(start_time end_time hosts).freeze
# Currently we use full payloads, when generating a fingerprint. # Currently we use full payloads, when generating a fingerprint.
# This results in a quite strict fingerprint. # This results in a quite strict fingerprint.
......
...@@ -51,6 +51,28 @@ RSpec.describe Projects::Alerting::NotifyService do ...@@ -51,6 +51,28 @@ RSpec.describe Projects::Alerting::NotifyService do
it 'increments the existing alert count' do it 'increments the existing alert count' do
expect { subject }.to change { existing_alert.reload.events }.from(1).to(2) expect { subject }.to change { existing_alert.reload.events }.from(1).to(2)
end end
context 'end_time provided for subsequent alert' do
before do
payload[:end_time] = Time.current.change(usec: 0).iso8601
end
let(:existing_alert) do
existing_payload = payload.except(:end_time)
described_class.new(project, nil, existing_payload).execute(token)
AlertManagement::Alert.last!
end
it 'does not create AlertManagement::Alert' do
expect { subject }.not_to change(AlertManagement::Alert, :count)
end
it 'resolves the existing alert', :aggregate_failures do
expect { subject }.to change { existing_alert.reload.resolved? }.from(false).to(true)
expect(existing_alert.ended_at).to eq(payload[:end_time])
end
end
end 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