diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-24 21:12:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-24 21:12:18 +0300 |
commit | 06c57a837802f789b9276e23d7f505d95270f033 (patch) | |
tree | b45a80632d84a459b11376e1b575928c911eb045 /spec/lib | |
parent | 53ab147992c8e791582f625c80811fdda5ba4d5a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
3 files changed, 60 insertions, 2 deletions
diff --git a/spec/lib/gitlab/alert_management/payload/base_spec.rb b/spec/lib/gitlab/alert_management/payload/base_spec.rb index ad2a3c7b462..3e8d71ac673 100644 --- a/spec/lib/gitlab/alert_management/payload/base_spec.rb +++ b/spec/lib/gitlab/alert_management/payload/base_spec.rb @@ -347,4 +347,26 @@ RSpec.describe Gitlab::AlertManagement::Payload::Base do it { is_expected.to be(true) } end + + describe '#source' do + subject { parsed_payload.source } + + it { is_expected.to be_nil } + + context 'with alerting integration provided' do + before do + parsed_payload.integration = instance_double('::AlertManagement::HttpIntegration', name: 'INTEGRATION') + end + + it { is_expected.to eq('INTEGRATION') } + end + + context 'with monitoring tool defined in the raw payload' do + before do + allow(parsed_payload).to receive(:monitoring_tool).and_return('TOOL') + end + + it { is_expected.to eq('TOOL') } + end + end end diff --git a/spec/lib/gitlab/alert_management/payload/generic_spec.rb b/spec/lib/gitlab/alert_management/payload/generic_spec.rb index 59933f7459d..bc3b6edc638 100644 --- a/spec/lib/gitlab/alert_management/payload/generic_spec.rb +++ b/spec/lib/gitlab/alert_management/payload/generic_spec.rb @@ -144,4 +144,40 @@ RSpec.describe Gitlab::AlertManagement::Payload::Generic do it { is_expected.to eq(value) } end end + + describe '#resolved?' do + subject { parsed_payload.resolved? } + + context 'without end time' do + it { is_expected.to eq(false) } + end + + context 'with end time' do + let(:raw_payload) { { 'end_time' => Time.current.to_s } } + + it { is_expected.to eq(true) } + end + end + + describe '#source' do + subject { parsed_payload.source } + + it { is_expected.to eq('Generic Alert Endpoint') } + + context 'with alerting integration provided' do + before do + parsed_payload.integration = instance_double('::AlertManagement::HttpIntegration', name: 'INTEGRATION') + end + + it { is_expected.to eq('INTEGRATION') } + end + + context 'with monitoring tool defined in the raw payload' do + before do + allow(parsed_payload).to receive(:monitoring_tool).and_return('TOOL') + end + + it { is_expected.to eq('TOOL') } + end + end end diff --git a/spec/lib/gitlab/background_migration/rename_task_system_note_to_checklist_item_spec.rb b/spec/lib/gitlab/background_migration/rename_task_system_note_to_checklist_item_spec.rb index 6996249cb40..45932defaf9 100644 --- a/spec/lib/gitlab/background_migration/rename_task_system_note_to_checklist_item_spec.rb +++ b/spec/lib/gitlab/background_migration/rename_task_system_note_to_checklist_item_spec.rb @@ -50,8 +50,8 @@ RSpec.describe Gitlab::BackgroundMigration::RenameTaskSystemNoteToChecklistItem let(:migration) do described_class.new( - start_id: note1.id, - end_id: note4.id, + start_id: metadata1.id, + end_id: metadata4.id, batch_table: :system_note_metadata, batch_column: :id, sub_batch_size: 2, |