Commit 835a1e09 authored by Mark Chao's avatar Mark Chao

Merge branch 'eb-remove-ff-339974' into 'master'

Remove query_project_ci_feature_usages_for_coverage flag

See merge request gitlab-org/gitlab!74230
parents a3982e3c b92364cc
---
name: query_project_ci_feature_usages_for_coverage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69890
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/339974
milestone: '14.3'
type: development
group: group::testing
default_enabled: false
......@@ -39,11 +39,7 @@ module EE
def with_code_coverage(items)
return items unless params[:has_code_coverage].present?
if ::Feature.enabled?(:query_project_ci_feature_usages_for_coverage, namespace, default_enabled: :yaml)
items.with_coverage_feature_usage(default_branch: true)
else
items.with_code_coverage
end
items.with_coverage_feature_usage(default_branch: true)
end
end
end
......
......@@ -122,11 +122,6 @@ module EE
.limit(limit)
end
scope :with_code_coverage, -> do
joins(:daily_build_group_report_results).merge(::Ci::DailyBuildGroupReportResult.with_coverage.with_default_branch).group(:id)
.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/339974')
end
scope :with_coverage_feature_usage, ->(default_branch: nil) do
join_conditions = { feature: :code_coverage }
join_conditions[:default_branch] = default_branch unless default_branch.nil?
......
......@@ -69,36 +69,14 @@ RSpec.describe Namespaces::ProjectsFinder do
create(:ci_daily_build_group_report_result, project: project_2, default_branch: false)
end
context 'and query_project_ci_feature_usages_for_coverage flag is enabled for the given group' do
before do
stub_feature_flags(query_project_ci_feature_usages_for_coverage: namespace)
it 'returns projects with code coverage on default branch based on ci feature usages' do
record = ActiveRecord::QueryRecorder.new do
expect(projects).to contain_exactly(project_1)
end
it 'returns projects with code coverage on default branch based on ci feature usages' do
record = ActiveRecord::QueryRecorder.new do
expect(projects).to contain_exactly(project_1)
end
queried_ci_table = record.log.any? {|l| l.include?('ci_daily_build_group_report_results')}
queried_ci_table = record.log.any? {|l| l.include?('ci_daily_build_group_report_results')}
expect(queried_ci_table).to eq(false)
end
end
context 'and query_project_ci_feature_usages_for_coverage flag is disabled for the given group' do
before do
stub_feature_flags(query_project_ci_feature_usages_for_coverage: create(:group))
end
it 'returns projects with code coverage on default branch based on daily build group report results' do
record = ActiveRecord::QueryRecorder.new do
expect(projects).to contain_exactly(project_1)
end
queried_ci_table = record.log.any? {|l| l.include?('ci_daily_build_group_report_results')}
expect(queried_ci_table).to eq(true)
end
expect(queried_ci_table).to eq(false)
end
end
......
......@@ -78,36 +78,14 @@ RSpec.describe Resolvers::NamespaceProjectsResolver do
create(:ci_daily_build_group_report_result, project: project_2, default_branch: false)
end
context 'and query_project_ci_feature_usages_for_coverage flag is enabled for the given group' do
before do
stub_feature_flags(query_project_ci_feature_usages_for_coverage: group)
it 'returns projects with code coverage on default branch based on ci feature usages' do
record = ActiveRecord::QueryRecorder.new do
expect(projects).to contain_exactly(project_1)
end
it 'returns projects with code coverage on default branch based on ci feature usages' do
record = ActiveRecord::QueryRecorder.new do
expect(projects).to contain_exactly(project_1)
end
queried_ci_table = record.log.any? {|l| l.include?('ci_daily_build_group_report_results')}
queried_ci_table = record.log.any? {|l| l.include?('ci_daily_build_group_report_results')}
expect(queried_ci_table).to eq(false)
end
end
context 'and query_project_ci_feature_usages_for_coverage flag is disabled for the given group' do
before do
stub_feature_flags(query_project_ci_feature_usages_for_coverage: false)
end
it 'returns projects with code coverage on default branch based on daily build group report results' do
record = ActiveRecord::QueryRecorder.new do
expect(projects).to contain_exactly(project_1)
end
queried_ci_table = record.log.any? {|l| l.include?('ci_daily_build_group_report_results')}
expect(queried_ci_table).to eq(true)
end
expect(queried_ci_table).to eq(false)
end
end
end
......
......@@ -414,19 +414,6 @@ RSpec.describe Project do
it { is_expected.to eq([project_2, project_3, project_1]) }
end
describe '.with_code_coverage' do
let_it_be(:project_1) { create(:project) }
let_it_be(:project_2) { create(:project) }
let_it_be(:project_3) { create(:project) }
let!(:coverage_1) { create(:ci_daily_build_group_report_result, project: project_1) }
let!(:coverage_2) { create(:ci_daily_build_group_report_result, project: project_2) }
subject { described_class.with_code_coverage }
it { is_expected.to contain_exactly(project_1, project_2) }
end
describe '.with_coverage_feature_usage' do
let_it_be(:project_1) { create(:project) }
let_it_be(:project_2) { create(:project) }
......
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