Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
474e5368
Commit
474e5368
authored
Jul 23, 2019
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't send CI usage email notifications for self-hosted instances
Notifications should be only sent for GL.com customers.
parent
fce7307f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
0 deletions
+32
-0
ee/app/services/ci_minutes_usage_notify_service.rb
ee/app/services/ci_minutes_usage_notify_service.rb
+2
-0
ee/changelogs/unreleased/rd-do-not-send-ci-quota-notifications-for-self-hosted-users.yml
...not-send-ci-quota-notifications-for-self-hosted-users.yml
+5
-0
ee/spec/services/ci_minutes_usage_notify_service_spec.rb
ee/spec/services/ci_minutes_usage_notify_service_spec.rb
+24
-0
ee/spec/workers/build_finished_worker_spec.rb
ee/spec/workers/build_finished_worker_spec.rb
+1
-0
No files found.
ee/app/services/ci_minutes_usage_notify_service.rb
View file @
474e5368
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
class
CiMinutesUsageNotifyService
<
BaseService
class
CiMinutesUsageNotifyService
<
BaseService
def
execute
def
execute
return
unless
::
Gitlab
.
com?
notify_on_total_usage
notify_on_total_usage
notify_on_partial_usage
notify_on_partial_usage
end
end
...
...
ee/changelogs/unreleased/rd-do-not-send-ci-quota-notifications-for-self-hosted-users.yml
0 → 100644
View file @
474e5368
---
title
:
Don't send CI usage email notifications for self-hosted instances
merge_request
:
14809
author
:
type
:
fixed
ee/spec/services/ci_minutes_usage_notify_service_spec.rb
View file @
474e5368
...
@@ -32,6 +32,12 @@ describe CiMinutesUsageNotifyService do
...
@@ -32,6 +32,12 @@ describe CiMinutesUsageNotifyService do
create
(
:namespace_statistics
,
namespace:
namespace
,
shared_runners_seconds:
ci_minutes_used
*
60
)
create
(
:namespace_statistics
,
namespace:
namespace
,
shared_runners_seconds:
ci_minutes_used
*
60
)
end
end
let
(
:gitlab_dot_com
)
{
true
}
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
gitlab_dot_com
)
end
describe
'#execute'
do
describe
'#execute'
do
let
(
:extra_ci_minutes
)
{
0
}
let
(
:extra_ci_minutes
)
{
0
}
let
(
:namespace
)
do
let
(
:namespace
)
do
...
@@ -40,6 +46,17 @@ describe CiMinutesUsageNotifyService do
...
@@ -40,6 +46,17 @@ describe CiMinutesUsageNotifyService do
subject
{
described_class
.
new
(
project
).
execute
}
subject
{
described_class
.
new
(
project
).
execute
}
context
'when it is not GitLab.com'
do
let
(
:gitlab_dot_com
)
{
false
}
let
(
:ci_minutes_used
)
{
2500
}
it
'does not send the email to all the owners'
do
expect
(
CiMinutesUsageMailer
).
not_to
receive
(
:notify
)
subject
end
end
context
'with a personal namespace'
do
context
'with a personal namespace'
do
before
do
before
do
namespace
.
update
(
owner_id:
user
.
id
)
namespace
.
update
(
owner_id:
user
.
id
)
...
@@ -165,6 +182,13 @@ describe CiMinutesUsageNotifyService do
...
@@ -165,6 +182,13 @@ describe CiMinutesUsageNotifyService do
end
end
context
'when available minutes have reached the first level of alert'
do
context
'when available minutes have reached the first level of alert'
do
context
'when it is not GitLab.com'
do
let
(
:gitlab_dot_com
)
{
false
}
let
(
:ci_minutes_used
)
{
1500
}
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
...
...
ee/spec/workers/build_finished_worker_spec.rb
View file @
474e5368
...
@@ -22,6 +22,7 @@ describe BuildFinishedWorker do
...
@@ -22,6 +22,7 @@ describe BuildFinishedWorker do
describe
'#perform'
do
describe
'#perform'
do
before
do
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
allow_any_instance_of
(
EE
::
Project
).
to
receive
(
:shared_runners_minutes_limit_enabled?
).
and_return
(
true
)
allow_any_instance_of
(
EE
::
Project
).
to
receive
(
:shared_runners_minutes_limit_enabled?
).
and_return
(
true
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment