Commit 600eb3fc authored by Markus Koller's avatar Markus Koller

Merge branch 'fix-unresolved-value-error-in-instance-statistics-graphql-api' into 'master'

Fix UnresolvedValueError in instance statistics

See merge request gitlab-org/gitlab!44475
parents 9b32247c bb70cd89
......@@ -8,16 +8,16 @@ module Types
graphql_name 'MeasurementIdentifier'
description 'Possible identifier types for a measurement'
value 'PROJECTS', 'Project count', value: :projects
value 'USERS', 'User count', value: :users
value 'ISSUES', 'Issue count', value: :issues
value 'MERGE_REQUESTS', 'Merge request count', value: :merge_requests
value 'GROUPS', 'Group count', value: :groups
value 'PIPELINES', 'Pipeline count', value: :pipelines
value 'PIPELINES_SUCCEEDED', 'Pipeline count with success status', value: :pipelines_succeeded
value 'PIPELINES_FAILED', 'Pipeline count with failed status', value: :pipelines_failed
value 'PIPELINES_CANCELED', 'Pipeline count with canceled status', value: :pipelines_canceled
value 'PIPELINES_SKIPPED', 'Pipeline count with skipped status', value: :pipelines_skipped
value 'PROJECTS', 'Project count', value: 'projects'
value 'USERS', 'User count', value: 'users'
value 'ISSUES', 'Issue count', value: 'issues'
value 'MERGE_REQUESTS', 'Merge request count', value: 'merge_requests'
value 'GROUPS', 'Group count', value: 'groups'
value 'PIPELINES', 'Pipeline count', value: 'pipelines'
value 'PIPELINES_SUCCEEDED', 'Pipeline count with success status', value: 'pipelines_succeeded'
value 'PIPELINES_FAILED', 'Pipeline count with failed status', value: 'pipelines_failed'
value 'PIPELINES_CANCELED', 'Pipeline count with canceled status', value: 'pipelines_canceled'
value 'PIPELINES_SKIPPED', 'Pipeline count with skipped status', value: 'pipelines_skipped'
end
end
end
......
---
title: Fix instance statistics GraphQL query with identifier
merge_request: 44475
author:
type: fixed
......@@ -9,13 +9,16 @@ RSpec.describe 'InstanceStatisticsMeasurements' do
let!(:instance_statistics_measurement_1) { create(:instance_statistics_measurement, :project_count, recorded_at: 20.days.ago, count: 5) }
let!(:instance_statistics_measurement_2) { create(:instance_statistics_measurement, :project_count, recorded_at: 10.days.ago, count: 10) }
let(:query) { graphql_query_for(:instanceStatisticsMeasurements, 'identifier: PROJECTS', 'nodes { count }') }
let(:query) { graphql_query_for(:instanceStatisticsMeasurements, 'identifier: PROJECTS', 'nodes { count identifier }') }
before do
post_graphql(query, current_user: current_user)
end
it 'returns measurement objects' do
expect(graphql_data.dig('instanceStatisticsMeasurements', 'nodes')).to eq([{ "count" => 10 }, { "count" => 5 }])
expect(graphql_data.dig('instanceStatisticsMeasurements', 'nodes')).to eq([
{ "count" => 10, 'identifier' => 'PROJECTS' },
{ "count" => 5, 'identifier' => 'PROJECTS' }
])
end
end
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