Skip to content
Snippets Groups Projects
Unverified Commit acc18358 authored by Marius Bobin's avatar Marius Bobin
Browse files

Enable live consumption for all paid plans

Changelog: changed
parent bff3a296
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -77,8 +77,6 @@ def validate_preconditions
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
Loading
Loading
@@ -90,10 +88,6 @@ def feature_enabled?
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
Loading
Loading
Loading
Loading
@@ -11,10 +11,6 @@
 
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 }
 
Loading
Loading
@@ -76,22 +72,6 @@
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)
Loading
Loading
@@ -143,6 +123,14 @@
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)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment