diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-20 15:08:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-20 15:08:54 +0300 |
commit | be2142bf5e03af8ba9bb96e4bf0b4781184ae01b (patch) | |
tree | b40aab281b29a56bd398757564d271c8b3aa8662 /spec/services/alert_management | |
parent | bc12365ae0254332f97299138f019bea3ff12351 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/alert_management')
-rw-r--r-- | spec/services/alert_management/process_prometheus_alert_service_spec.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/spec/services/alert_management/process_prometheus_alert_service_spec.rb b/spec/services/alert_management/process_prometheus_alert_service_spec.rb index ad4ab26c198..ae0b8d6d7ac 100644 --- a/spec/services/alert_management/process_prometheus_alert_service_spec.rb +++ b/spec/services/alert_management/process_prometheus_alert_service_spec.rb @@ -117,15 +117,19 @@ RSpec.describe AlertManagement::ProcessPrometheusAlertService do end context 'when alert cannot be created' do + let(:errors) { double(messages: { hosts: ['hosts array is over 255 chars'] })} + before do - payload['annotations']['title'] = 'description' * 50 + allow(service).to receive(:alert).and_call_original + allow(service).to receive_message_chain(:alert, :save).and_return(false) + allow(service).to receive_message_chain(:alert, :errors).and_return(errors) end it 'writes a warning to the log' do expect(Gitlab::AppLogger).to receive(:warn).with( message: 'Unable to create AlertManagement::Alert', project_id: project.id, - alert_errors: { title: ["is too long (maximum is 200 characters)"] } + alert_errors: { hosts: ['hosts array is over 255 chars'] } ) execute |