diff --git a/config/feature_flags/development/skip_checking_namespace_in_query.yml b/config/feature_flags/development/skip_checking_namespace_in_query.yml new file mode 100644 index 0000000000000000000000000000000000000000..2b9e3cbfe0bc0fa1ffa99c527442fe4fb3f42246 --- /dev/null +++ b/config/feature_flags/development/skip_checking_namespace_in_query.yml @@ -0,0 +1,8 @@ +--- +name: skip_checking_namespace_in_query +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96559 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/370742 +milestone: '15.4' +type: development +group: group::source code +default_enabled: false diff --git a/ee/app/workers/update_all_mirrors_worker.rb b/ee/app/workers/update_all_mirrors_worker.rb index 032335fafc5e4b56824e6eb675ef743515146494..536a52a9df77586f3b81c47408f57b52ed5d1efc 100644 --- a/ee/app/workers/update_all_mirrors_worker.rb +++ b/ee/app/workers/update_all_mirrors_worker.rb @@ -166,7 +166,7 @@ def schedule_projects_in_batch(projects) end def check_mirror_plans_in_query? - ::Gitlab::CurrentSettings.should_check_namespace_plan? + ::Gitlab::CurrentSettings.should_check_namespace_plan? && Feature.disabled?(:skip_checking_namespace_in_query) end # rubocop: disable CodeReuse/ActiveRecord diff --git a/ee/spec/workers/update_all_mirrors_worker_spec.rb b/ee/spec/workers/update_all_mirrors_worker_spec.rb index bf1fdc2af749b517d0abdbe629ba030e59a52f88..436d8b446d73a0f65df7150ce4a7e9c74dfc3a60 100644 --- a/ee/spec/workers/update_all_mirrors_worker_spec.rb +++ b/ee/spec/workers/update_all_mirrors_worker_spec.rb @@ -404,4 +404,24 @@ def scheduled_mirror(at:, licensed:, public: false, subgroup: nil) end end end + + describe '#check_mirror_plans_in_query?' do + using RSpec::Parameterized::TableSyntax + + where(:should_check_namespace_plan, :skip_checking_namespace_in_query, :check_mirror_plans_in_query) do + false | false | false + false | true | false + true | false | true + true | true | false + end + + with_them do + it 'defines whether a mirror plans are checked in query' do + allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(should_check_namespace_plan) + stub_feature_flags(skip_checking_namespace_in_query: skip_checking_namespace_in_query) + + expect(subject.send(:check_mirror_plans_in_query?)).to eq(check_mirror_plans_in_query) + end + end + end end