Commit f645ce7a authored by Grzegorz Bizon's avatar Grzegorz Bizon

Expose CI/CD Quotas limits in the namespace / group

parent b4fcaa6c
......@@ -108,6 +108,16 @@ module EE
end
end
# TODO, CI/CD Quotas feature check
#
def max_active_pipelines
plan&.active_pipelines_limit.to_i
end
def max_pipeline_size
plan&.pipeline_size_limit.to_i
end
private
def validate_plan_name
......
......@@ -156,6 +156,64 @@ describe Namespace do
end
end
describe '#max_active_pipelines' do
context 'when there is no plan associated' do
it 'returns zero' do
expect(namespace.max_active_pipelines).to be_zero
end
end
context 'when limit is not defined' do
before do
namespace.plan = Namespace::GOLD_PLAN
end
it 'returns zero' do
expect(namespace.max_active_pipelines).to be_zero
end
end
context 'when limit is defined' do
before do
namespace.plan = Namespace::GOLD_PLAN
namespace.plan.update_column(:active_pipelines_limit, 10)
end
it 'returns a number of maximum active pipelines' do
expect(namespace.max_active_pipelines).to eq 10
end
end
end
describe '#max_pipeline_size' do
context 'when there is no plan associated' do
it 'returns zero' do
expect(namespace.max_active_pipelines).to be_zero
end
end
context 'when limit is not defined' do
before do
namespace.plan = Namespace::GOLD_PLAN
end
it 'returns zero' do
expect(namespace.max_pipeline_size).to be_zero
end
end
context 'when limit is defined' do
before do
namespace.plan = Namespace::GOLD_PLAN
namespace.plan.update_column(:pipeline_size_limit, 15)
end
it 'returns a number of maximum pipeline size' do
expect(namespace.max_pipeline_size).to eq 15
end
end
end
describe '#shared_runners_enabled?' do
subject { namespace.shared_runners_enabled? }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment