diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-10 09:09:39 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-10 09:09:39 +0000 |
commit | c52b81f45762cb7f05a950689dfc6d51b197ea73 (patch) | |
tree | c44830c2fc21d13b81814958c44b09fa8d11c805 /spec/services/metrics | |
parent | 187ee320b39af22929d74c5a2d9b0650bf50a09b (diff) | |
download | gitlab-ce-c52b81f45762cb7f05a950689dfc6d51b197ea73.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/metrics')
-rw-r--r-- | spec/services/metrics/dashboard/custom_metric_embed_service_spec.rb | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/spec/services/metrics/dashboard/custom_metric_embed_service_spec.rb b/spec/services/metrics/dashboard/custom_metric_embed_service_spec.rb index 2f03d18cd1f..1a9ddc87ab0 100644 --- a/spec/services/metrics/dashboard/custom_metric_embed_service_spec.rb +++ b/spec/services/metrics/dashboard/custom_metric_embed_service_spec.rb @@ -121,11 +121,18 @@ describe Metrics::Dashboard::CustomMetricEmbedService do it_behaves_like 'valid embedded dashboard service response' - it 'includes both metrics' do + it 'includes both metrics in a single panel' do result = service_call - included_queries = all_queries(result[:dashboard]) - expect(included_queries).to include('avg(metric_2)', 'avg(metric)') + panel_groups = result[:dashboard][:panel_groups] + panels = panel_groups[0][:panels] + metrics = panels[0][:metrics] + queries = metrics.map { |metric| metric[:query_range] } + + expect(panel_groups.length).to eq(1) + expect(panels.length).to eq(1) + expect(metrics.length).to eq(2) + expect(queries).to include('avg(metric_2)', 'avg(metric)') end end end @@ -136,16 +143,4 @@ describe Metrics::Dashboard::CustomMetricEmbedService do it_behaves_like 'misconfigured dashboard service response', :not_found end end - - private - - def all_queries(dashboard) - dashboard[:panel_groups].flat_map do |group| - group[:panels].flat_map do |panel| - panel[:metrics].map do |metric| - metric[:query_range] - end - end - end - end end |