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
acc18358
Commit
acc18358
authored
May 24, 2021
by
Marius Bobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable live consumption for all paid plans
Changelog: changed
parent
bff3a296
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
26 deletions
+8
-26
ee/app/services/ci/minutes/track_live_consumption_service.rb
ee/app/services/ci/minutes/track_live_consumption_service.rb
+0
-6
ee/spec/services/ci/minutes/track_live_consumption_service_spec.rb
...ervices/ci/minutes/track_live_consumption_service_spec.rb
+8
-20
No files found.
ee/app/services/ci/minutes/track_live_consumption_service.rb
View file @
acc18358
...
...
@@ -77,8 +77,6 @@ module Ci
ServiceResponse
.
error
(
message:
'Feature not enabled'
)
elsif
!
build
.
running?
ServiceResponse
.
error
(
message:
'Build is not running'
)
elsif
!
free_or_trial_plan?
ServiceResponse
.
error
(
message:
'Project is not on Free or trial plan'
)
elsif
!
build
.
shared_runners_minutes_limit_enabled?
ServiceResponse
.
error
(
message:
'CI minutes limit not enabled for build'
)
else
...
...
@@ -90,10 +88,6 @@ module Ci
Feature
.
enabled?
(
:ci_minutes_track_live_consumption
,
build
.
project
,
default_enabled: :yaml
)
end
def
free_or_trial_plan?
Gitlab
.
com?
&&
(
root_namespace
.
free_plan?
||
root_namespace
.
trial?
)
end
def
consumption_since_last_update
last_tracking
=
time_last_tracked_consumption!
(
Time
.
current
.
utc
)
duration
=
Time
.
current
.
utc
-
last_tracking
...
...
ee/spec/services/ci/minutes/track_live_consumption_service_spec.rb
View file @
acc18358
...
...
@@ -11,10 +11,6 @@ RSpec.describe Ci::Minutes::TrackLiveConsumptionService do
let
(
:service
)
{
described_class
.
new
(
build
)
}
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
end
describe
'#execute'
,
:clean_gitlab_redis_shared_state
do
subject
{
service
.
execute
}
...
...
@@ -76,22 +72,6 @@ RSpec.describe Ci::Minutes::TrackLiveConsumptionService do
it_behaves_like
'returns early'
,
'CI minutes limit not enabled for build'
end
context
'when project is not on Free plan'
do
before
do
create
(
:gitlab_subscription
,
:premium
,
namespace:
namespace
)
end
it_behaves_like
'returns early'
,
'Project is not on Free or trial plan'
end
context
'when running on self-hosted'
do
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
end
it_behaves_like
'returns early'
,
'Project is not on Free or trial plan'
end
context
'when shared runners limit is not enabled for build'
do
before
do
allow
(
build
).
to
receive
(
:shared_runners_minutes_limit_enabled?
).
and_return
(
false
)
...
...
@@ -143,6 +123,14 @@ RSpec.describe Ci::Minutes::TrackLiveConsumptionService do
it_behaves_like
'limit exceeded'
end
context
'when namespace is on a paid plan'
do
before
do
create
(
:gitlab_subscription
,
:premium
,
namespace:
namespace
)
end
it_behaves_like
'limit exceeded'
end
context
'when feature flag is disabled'
do
before
do
stub_feature_flags
(
ci_minutes_track_live_consumption:
false
)
...
...
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