Commit e869cbb8 authored by Rubén Dávila's avatar Rubén Dávila

Don't send CI usage email notifications when quota is unlimited

parent 474e5368
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
class CiMinutesUsageNotifyService < BaseService class CiMinutesUsageNotifyService < BaseService
def execute def execute
return unless ::Gitlab.com? return unless ::Gitlab.com?
return unless namespace.shared_runners_minutes_limit_enabled?
notify_on_total_usage notify_on_total_usage
notify_on_partial_usage notify_on_partial_usage
......
---
title: Don't send CI usage email notifications when quota is unlimited
merge_request: 14810
author:
type: fixed
...@@ -189,6 +189,18 @@ describe CiMinutesUsageNotifyService do ...@@ -189,6 +189,18 @@ describe CiMinutesUsageNotifyService do
it_behaves_like 'no notification is sent' it_behaves_like 'no notification is sent'
end end
context 'when quota is unlimited' do
# Gitlab.com? => true is required in order to excercise the notification
let(:gitlab_dot_com) { true }
let(:ci_minutes_used) { 1500 }
before do
namespace.update_attribute(:shared_runners_minutes_limit, 0)
end
it_behaves_like 'no notification is sent'
end
it_behaves_like 'notification for custom level is sent', 1500, 30 it_behaves_like 'notification for custom level is sent', 1500, 30
context 'when other Pipeline has finished but second level of alert has not been reached' do context 'when other Pipeline has finished but second level of alert has not been reached' 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