Commit 2c75a5c4 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Move #auto_resolve_prometheus_alert to CE

Move `SystemNotes#IssuablesService#auto_resolve_prometheus_alert`
from EE to CE.

Contributes to migration of Prometheus alerts to Core
parent ad9e7c76
...@@ -288,6 +288,12 @@ module SystemNotes ...@@ -288,6 +288,12 @@ module SystemNotes
create_note(NoteSummary.new(noteable, project, author, body, action: 'closed')) create_note(NoteSummary.new(noteable, project, author, body, action: 'closed'))
end end
def auto_resolve_prometheus_alert
body = 'automatically closed this issue because the alert resolved.'
create_note(NoteSummary.new(noteable, project, author, body, action: 'closed'))
end
private private
def cross_reference_note_content(gfm_reference) def cross_reference_note_content(gfm_reference)
......
...@@ -44,12 +44,6 @@ module EE ...@@ -44,12 +44,6 @@ module EE
create_note(NoteSummary.new(noteable, project, author, body, action: 'weight')) create_note(NoteSummary.new(noteable, project, author, body, action: 'weight'))
end end
def auto_resolve_prometheus_alert
body = 'automatically closed this issue because the alert resolved.'
create_note(NoteSummary.new(noteable, project, author, body, action: 'closed'))
end
end end
end end
end end
...@@ -74,16 +74,4 @@ describe ::SystemNotes::IssuablesService do ...@@ -74,16 +74,4 @@ describe ::SystemNotes::IssuablesService do
end end
end end
end end
describe '#auto_resolve_prometheus_alert' do
subject { service.auto_resolve_prometheus_alert }
it_behaves_like 'a system note' do
let(:action) { 'closed' }
end
it 'creates the expected system note' do
expect(subject.note).to eq('automatically closed this issue because the alert resolved.')
end
end
end end
...@@ -654,4 +654,16 @@ describe ::SystemNotes::IssuablesService do ...@@ -654,4 +654,16 @@ describe ::SystemNotes::IssuablesService do
.to eq('resolved the corresponding error and closed the issue.') .to eq('resolved the corresponding error and closed the issue.')
end end
end end
describe '#auto_resolve_prometheus_alert' do
subject { service.auto_resolve_prometheus_alert }
it_behaves_like 'a system note' do
let(:action) { 'closed' }
end
it 'creates the expected system note' do
expect(subject.note).to eq('automatically closed this issue because the alert resolved.')
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