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
03e379f2
Commit
03e379f2
authored
May 10, 2021
by
Vijay Hawoldar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent future renewal checks if no gitlab subscription
parent
112b08b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
ee/lib/gitlab/expiring_subscription_message.rb
ee/lib/gitlab/expiring_subscription_message.rb
+1
-1
ee/spec/lib/gitlab/expiring_subscription_message_spec.rb
ee/spec/lib/gitlab/expiring_subscription_message_spec.rb
+26
-2
No files found.
ee/lib/gitlab/expiring_subscription_message.rb
View file @
03e379f2
...
...
@@ -120,7 +120,7 @@ module Gitlab
end
def
subscription_future_renewal?
return
if
self_managed?
||
namespace
.
nil?
return
if
self_managed?
||
namespace
.
nil?
||
!
namespace
.
gitlab_subscription
.
present?
::
GitlabSubscriptions
::
CheckFutureRenewalService
.
new
(
namespace:
namespace
).
execute
end
...
...
ee/spec/lib/gitlab/expiring_subscription_message_spec.rb
View file @
03e379f2
...
...
@@ -112,7 +112,7 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do
context
'with namespace'
do
let
(
:has_future_renewal
)
{
false
}
let_it_be
(
:namespace
)
{
create
(
:group
,
name:
'No Limit Records'
)
}
let_it_be
(
:namespace
)
{
create
(
:group
_with_plan
,
name:
'No Limit Records'
)
}
before
do
allow_next_instance_of
(
GitlabSubscriptions
::
CheckFutureRenewalService
,
namespace:
namespace
)
do
|
service
|
...
...
@@ -141,6 +141,16 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do
it
{
is_expected
.
to
be_nil
}
end
context
'without gitlab_subscription'
do
let
(
:namespace
)
{
build
(
:group
,
name:
'No Subscription Records'
)
}
it
'does not check for a future renewal'
do
expect
(
GitlabSubscriptions
::
CheckFutureRenewalService
).
not_to
receive
(
:new
)
subject
end
end
end
end
...
...
@@ -200,12 +210,16 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do
let
(
:has_future_renewal
)
{
false
}
let_it_be
(
:namespace
)
{
create
(
:group
,
name:
'No Limit Records'
)
}
let_it_be
(
:namespace
)
{
create
(
:group
_with_plan
,
name:
'No Limit Records'
)
}
before
do
allow_next_instance_of
(
GitlabSubscriptions
::
CheckFutureRenewalService
,
namespace:
namespace
)
do
|
service
|
allow
(
service
).
to
receive
(
:execute
).
and_return
(
has_future_renewal
)
end
allow_next_instance_of
(
Group
)
do
|
group
|
allow
(
group
).
to
receive
(
:gitlab_subscription
).
and_return
(
gitlab_subscription
)
end
end
where
plan:
%w(gold ultimate)
...
...
@@ -255,6 +269,16 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do
it
{
is_expected
.
to
be_nil
}
end
context
'without gitlab_subscription'
do
let
(
:namespace
)
{
build
(
:group
,
name:
'No Subscription Records'
)
}
it
'does not check for a future renewal'
do
expect
(
GitlabSubscriptions
::
CheckFutureRenewalService
).
not_to
receive
(
:new
)
subject
end
end
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