diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/services/metrics | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/services/metrics')
-rw-r--r-- | spec/services/metrics/dashboard/custom_dashboard_service_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/services/metrics/dashboard/custom_dashboard_service_spec.rb b/spec/services/metrics/dashboard/custom_dashboard_service_spec.rb index aea9c25d104..5dc30c156ac 100644 --- a/spec/services/metrics/dashboard/custom_dashboard_service_spec.rb +++ b/spec/services/metrics/dashboard/custom_dashboard_service_spec.rb @@ -67,6 +67,23 @@ RSpec.describe Metrics::Dashboard::CustomDashboardService, :use_clean_rails_memo .at_least(:once) end + context 'with metric in database' do + let!(:prometheus_metric) do + create(:prometheus_metric, project: project, identifier: 'metric_a1', group: 'custom') + end + + it 'includes metric_id' do + dashboard = described_class.new(*service_params).get_dashboard + + metric_id = dashboard[:dashboard][:panel_groups].find { |panel_group| panel_group[:group] == 'Group A' } + .fetch(:panels).find { |panel| panel[:title] == 'Super Chart A1' } + .fetch(:metrics).find { |metric| metric[:id] == 'metric_a1' } + .fetch(:metric_id) + + expect(metric_id).to eq(prometheus_metric.id) + end + end + context 'and the dashboard is then deleted' do it 'does not return the previously cached dashboard' do described_class.new(*service_params).get_dashboard |