Skip to content
Snippets Groups Projects
Commit 670aa49b authored by pshutsin's avatar pshutsin
Browse files

Merge branch '384551-fix-vsa-dora-metrics-classes' into 'master'

Pass the correct container object for DORA metrics

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111916



Merged-by: default avatarPavel Shutsin <pshutsin@gitlab.com>
Approved-by: default avatarSerena Fang <sfang@gitlab.com>
Approved-by: default avatarPavel Shutsin <pshutsin@gitlab.com>
Reviewed-by: default avatarSerena Fang <sfang@gitlab.com>
Co-authored-by: default avatarAdam Hegyi <ahegyi@gitlab.com>
parents 1ac0c568 ba86371f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -48,7 +48,7 @@ def dora_metric
params[:group_project_ids] = options[:projects] if options[:projects].present?
 
Dora::AggregateMetricsService.new(
container: stage.parent,
container: container,
current_user: current_user,
params: params
).execute
Loading
Loading
@@ -61,6 +61,10 @@ def convert_to_days(seconds)
 
Gitlab::CycleAnalytics::Summary::Value::Numeric.new(days)
end
def container
stage.namespace.is_a?(Namespaces::ProjectNamespace) ? stage.namespace.project : stage.namespace
end
end
end
end
Loading
Loading
Loading
Loading
@@ -15,6 +15,23 @@
 
subject(:result) { described_class.new(stage: stage, current_user: user, options: options).value }
 
context 'when ProjectNamespace based stage is given' do
let(:user) { create(:user) }
let(:group) { create(:group).tap { |g| g.add_developer(user) } }
let(:project) { create(:project, group: group) }
let(:stage) { build(:cycle_analytics_stage, project: project) }
subject(:result) { described_class.new(stage: stage, current_user: user, options: options).value }
before do
stub_licensed_features(dora4_analytics: true)
end
it 'returns none value' do
expect(result.to_s).to eq('-')
end
end
context 'when the DORA service returns non-successful status' do
it 'returns nil' do
expect_next_instance_of(Dora::AggregateMetricsService) do |service|
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment