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
6c9ace38
Commit
6c9ace38
authored
Apr 13, 2022
by
Jason Goodman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec to namespace storage email notification service
Cover more no storage limit scenarios
parent
c333ea24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
11 deletions
+28
-11
ee/spec/services/namespaces/storage/email_notification_service_spec.rb
...ces/namespaces/storage/email_notification_service_spec.rb
+28
-11
No files found.
ee/spec/services/namespaces/storage/email_notification_service_spec.rb
View file @
6c9ace38
...
...
@@ -93,6 +93,34 @@ RSpec.describe Namespaces::Storage::EmailNotificationService do
end
end
where
(
:limit
,
:used
,
:last_notification_level
)
do
0
|
0
|
:storage_remaining
0
|
150
|
:storage_remaining
0
|
0
|
:caution
0
|
100
|
:caution
0
|
0
|
:warning
0
|
50
|
:warning
0
|
0
|
:danger
0
|
50
|
:danger
0
|
0
|
:exceeded
0
|
1
|
:exceeded
end
with_them
do
it
'does not send an email when there is no storage limit'
do
set_storage_size_limit
(
group
,
megabytes:
limit
)
set_used_storage
(
group
,
megabytes:
used
)
set_notification_level
(
last_notification_level
)
expect
(
mailer
).
not_to
receive
(
:notify_out_of_storage
)
expect
(
mailer
).
not_to
receive
(
:notify_limit_warning
)
service
.
execute
(
group
)
expect
(
group
.
root_storage_statistics
.
reload
.
notification_level
.
to_sym
).
to
eq
(
:storage_remaining
)
end
end
it
'sends an email to all group owners'
do
set_storage_size_limit
(
group
,
megabytes:
100
)
set_used_storage
(
group
,
megabytes:
200
)
...
...
@@ -137,17 +165,6 @@ RSpec.describe Namespaces::Storage::EmailNotificationService do
end
end
it
'does nothing if there is no defined storage limit'
do
set_used_storage
(
group
,
megabytes:
150
)
expect
(
mailer
).
not_to
receive
(
:notify_out_of_storage
)
expect
(
mailer
).
not_to
receive
(
:notify_limit_warning
)
service
.
execute
(
group
)
expect
(
group
.
root_storage_statistics
.
reload
.
notification_level
).
to
eq
(
'storage_remaining'
)
end
it
'does nothing if there is no root_storage_statistics'
do
group
.
root_storage_statistics
.
destroy!
group
.
reload
...
...
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