Commit 864fa093 authored by ayufanpl's avatar ayufanpl

Flip shared_runner_minutes_on_subnamespace to shared_runner_minutes_on_root_namespace

parent a6bfa4b8
......@@ -11,10 +11,10 @@ class Groups::PipelineQuotaController < Groups::ApplicationController
private
def all_projects
if Feature.enabled?(:shared_runner_minutes_on_subnamespace)
@group.projects
else
if Feature.enabled?(:shared_runner_minutes_on_root_namespace)
@group.all_projects
else
@group.projects
end
end
......
......@@ -95,7 +95,7 @@ module EE
def shared_runner_minutes_supported?
if has_parent?
Feature.enabled?(:shared_runner_minutes_on_subnamespace)
!Feature.enabled?(:shared_runner_minutes_on_root_namespace)
else
true
end
......@@ -118,10 +118,10 @@ module EE
end
def shared_runners_enabled?
if Feature.enabled?(:shared_runner_minutes_on_subnamespace)
projects.with_shared_runners.any?
else
if Feature.enabled?(:shared_runner_minutes_on_root_namespace)
all_projects.with_shared_runners.any?
else
projects.with_shared_runners.any?
end
end
......
......@@ -83,10 +83,10 @@ module EE
end
def shared_runners_limit_namespace
if Feature.enabled?(:shared_runner_minutes_on_subnamespace)
namespace
else
if Feature.enabled?(:shared_runner_minutes_on_root_namespace)
root_namespace
else
namespace
end
end
......
......@@ -28,7 +28,7 @@ module EE
def all_namespaces
namespaces = ::Namespace.reorder(nil).where('namespaces.id = projects.namespace_id')
unless Feature.enabled?(:shared_runner_minutes_on_subnamespace)
if Feature.enabled?(:shared_runner_minutes_on_root_namespace)
namespaces = ::Gitlab::GroupHierarchy.new(namespaces).roots
end
......
......@@ -101,9 +101,9 @@ feature 'Groups > Pipeline Quota' do
end
end
context 'with shared_runner_minutes_on_subnamespace enabled' do
context 'with shared_runner_minutes_on_root_namespace disabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: true)
stub_feature_flags(shared_runner_minutes_on_root_namespace: false)
end
context 'when accessing group with subgroups' do
......@@ -120,9 +120,9 @@ feature 'Groups > Pipeline Quota' do
end
end
context 'with shared_runner_minutes_on_subnamespace disabled' do
context 'with shared_runner_minutes_on_root_namespace enabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: false)
stub_feature_flags(shared_runner_minutes_on_root_namespace: true)
end
context 'when accessing subgroup' do
......
......@@ -66,7 +66,7 @@ describe Namespace do
describe '#validate_shared_runner_minutes_support' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: false)
stub_feature_flags(shared_runner_minutes_on_root_namespace: true)
end
context 'when changing :shared_runners_minutes_limit' do
......@@ -331,9 +331,9 @@ describe Namespace do
namespace.parent = build(:group)
end
context 'when shared_runner_minutes_on_subnamespace is enabled' do
context 'when shared_runner_minutes_on_root_namespace is disabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: true)
stub_feature_flags(shared_runner_minutes_on_root_namespace: false)
end
it 'returns true' do
......@@ -341,9 +341,9 @@ describe Namespace do
end
end
context 'when shared_runner_minutes_on_subnamespace is disalbed' do
context 'when shared_runner_minutes_on_root_namespace is enabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: false)
stub_feature_flags(shared_runner_minutes_on_root_namespace: true)
end
it 'returns false' do
......@@ -382,7 +382,7 @@ describe Namespace do
context 'when is subgroup' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: false)
stub_feature_flags(shared_runner_minutes_on_root_namespace: true)
namespace.parent = build(:group)
end
......@@ -403,9 +403,9 @@ describe Namespace do
let(:subgroup) { create(:group, parent: namespace) }
let!(:subproject) { create(:project, namespace: subgroup, shared_runners_enabled: true) }
context 'when shared_runner_minutes_on_subnamespace is enabled' do
context 'when shared_runner_minutes_on_root_namespace is disabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: true)
stub_feature_flags(shared_runner_minutes_on_root_namespace: false)
end
it "returns false" do
......@@ -413,9 +413,9 @@ describe Namespace do
end
end
context 'when shared_runner_minutes_on_subnamespace is disabled' do
context 'when shared_runner_minutes_on_root_namespace is enabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: false)
stub_feature_flags(shared_runner_minutes_on_root_namespace: true)
end
it "returns true" do
......
......@@ -539,9 +539,9 @@ describe Project do
subject { project.shared_runners_limit_namespace }
context 'when shared_runner_minutes_on_subnamespace is enabled' do
context 'when shared_runner_minutes_on_root_namespace is disabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: true)
stub_feature_flags(shared_runner_minutes_on_root_namespace: false)
end
it 'returns parent namespace' do
......@@ -549,9 +549,9 @@ describe Project do
end
end
context 'when shared_runner_minutes_on_subnamespace is disabled' do
context 'when shared_runner_minutes_on_root_namespace is enabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: false)
stub_feature_flags(shared_runner_minutes_on_root_namespace: true)
end
it 'returns root namespace' do
......
......@@ -69,9 +69,9 @@ module Ci
let!(:project) { create :project, shared_runners_enabled: true, group: group }
let(:build) { execute(shared_runner) }
context 'when shared_runner_minutes_on_subnamespace is enabled' do
context 'when shared_runner_minutes_on_root_namespace is disabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: true)
stub_feature_flags(shared_runner_minutes_on_root_namespace: false)
end
it "does return a build" do
......@@ -90,9 +90,9 @@ module Ci
end
end
context 'when shared_runner_minutes_on_subnamespace is disabled' do
context 'when shared_runner_minutes_on_root_namespace is enabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: false)
stub_feature_flags(shared_runner_minutes_on_root_namespace: true)
end
it "does return a build" do
......
......@@ -10,9 +10,9 @@ describe 'admin/groups/_form' do
allow(view).to receive(:visibility_level) { group.visibility_level }
end
describe 'when :shared_runner_minutes_on_subnamespace is enabled' do
describe 'when :shared_runner_minutes_on_root_namespace is disabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: true)
stub_feature_flags(shared_runner_minutes_on_root_namespace: false)
end
context 'when sub group is used' do
......@@ -27,9 +27,9 @@ describe 'admin/groups/_form' do
end
end
describe 'when :shared_runner_minutes_on_subnamespace is disabled' do
describe 'when :shared_runner_minutes_on_root_namespace is enabled' do
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: false)
stub_feature_flags(shared_runner_minutes_on_root_namespace: true)
end
context 'when sub group is used' do
......
RSpec.configure do |config|
config.before(:all) do
puts "this feature is by default disabled"
Feature.get(:shared_runner_minutes_on_subnamespace).disable
end
end
......@@ -46,11 +46,11 @@ describe UpdateBuildMinutesService do
context 'when namespace is subgroup' do
let(:root_ancestor) { create(:group, shared_runners_minutes_limit: 100) }
context 'when shared_runner_minutes_on_subnamespace is enabled' do
context 'when shared_runner_minutes_on_root_namespace is disabled' do
let(:namespace) { create(:namespace, parent: root_ancestor, shared_runners_minutes_limit: 100) }
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: true)
stub_feature_flags(shared_runner_minutes_on_root_namespace: false)
end
it 'creates a statistics in current namespace' do
......@@ -61,11 +61,11 @@ describe UpdateBuildMinutesService do
end
end
context 'when shared_runner_minutes_on_subnamespace is disabled' do
context 'when shared_runner_minutes_on_root_namespace is enabled' do
let(:namespace) { create(:namespace, parent: root_ancestor) }
before do
stub_feature_flags(shared_runner_minutes_on_subnamespace: false)
stub_feature_flags(shared_runner_minutes_on_root_namespace: true)
end
it 'creates a statistics in root namespace' do
......
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