Commit ccf3b752 authored by Rémy Coutable's avatar Rémy Coutable

Fix several ID-dependent specs

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent eda4dc77
...@@ -59,21 +59,23 @@ describe IncidentManagement::ProcessPrometheusAlertWorker do ...@@ -59,21 +59,23 @@ describe IncidentManagement::ProcessPrometheusAlertWorker do
end end
end end
context 'when project could not be found', quarantine: 'https://gitlab.com/gitlab-org/gitlab/issues/208766' do context 'when project could not be found' do
let(:non_existing_project_id) { (Project.maximum(:id) || 0) + 1 }
it 'does not create an issue' do it 'does not create an issue' do
expect { subject.perform('1234', alert_params) } expect { subject.perform(non_existing_project_id, alert_params) }
.not_to change(Issue, :count) .not_to change(Issue, :count)
end end
it 'does not relate issue to an event' do it 'does not relate issue to an event' do
expect { subject.perform('1234', alert_params) } expect { subject.perform(non_existing_project_id, alert_params) }
.not_to change(prometheus_alert.related_issues, :count) .not_to change(prometheus_alert.related_issues, :count)
end end
end end
context 'when event could not be found' do context 'when event could not be found' do
before do before do
alert_params[:labels][:gitlab_alert_id] = '1234' alert_params[:labels][:gitlab_alert_id] = (PrometheusAlertEvent.maximum(:id) || 0) + 1
end end
it 'does not create an issue' do it 'does not create an issue' do
......
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