Commit 90e9ef26 authored by drew cimino's avatar drew cimino Committed by Shinya Maeda

Use MergeRequest#merge_base_pipeline for comparing Metrics reports [RUN ALL RSPEC] [RUN AS-IF-FOSS]

parent 155bf7e5
......@@ -37,6 +37,7 @@ class MergeRequest < ApplicationRecord
SORTING_PREFERENCE_FIELD = :merge_requests_sort
ALLOWED_TO_USE_MERGE_BASE_PIPELINE_FOR_COMPARISON = {
'Ci::CompareMetricsReportsService' => ->(project) { ::Gitlab::Ci::Features.merge_base_pipeline_for_metrics_comparison?(project) },
'Ci::CompareCodequalityReportsService' => ->(project) { true }
}.freeze
......
---
name: merge_base_pipeline_for_metrics_comparison
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61282
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/330809
milestone: '13.12'
type: development
group: group::testing
default_enabled: false
......@@ -18,6 +18,10 @@ module Gitlab
Feature.enabled?(:ci_pipeline_status_omit_commit_sha_in_cache_key, project, default_enabled: true)
end
def self.merge_base_pipeline_for_metrics_comparison?(project)
Feature.enabled?(:merge_base_pipeline_for_metrics_comparison, project, default_enabled: :yaml)
end
# Remove in https://gitlab.com/gitlab-org/gitlab/-/issues/224199
def self.store_pipeline_messages?(project)
::Feature.enabled?(:ci_store_pipeline_messages, project, default_enabled: true)
......
......@@ -3876,6 +3876,20 @@ RSpec.describe MergeRequest, factory_default: :keep do
subject { merge_request.use_merge_base_pipeline_for_comparison?(service_class) }
context 'when service class is Ci::CompareMetricsReportsService' do
let(:service_class) { 'Ci::CompareMetricsReportsService' }
it { is_expected.to be_truthy }
context 'with the metrics report flag disabled' do
before do
stub_feature_flags(merge_base_pipeline_for_metrics_comparison: false)
end
it { is_expected.to be_falsey }
end
end
context 'when service class is Ci::CompareCodequalityReportsService' do
let(:service_class) { 'Ci::CompareCodequalityReportsService' }
......
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