summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@gitlab.com>2019-07-31 06:32:48 +0000
committerJames Lopez <james@gitlab.com>2019-07-31 06:32:48 +0000
commit67ffe3ced0a704d78f528e5dc8ea4243e5e4a47f (patch)
tree94785d0dc7185f7bea154e2c5e4d41effcb0f349
parentaf9b1ffa75c8bb4e6e80d9d5cd2ad34487c0446c (diff)
parent74563593b9c6e87bd5f1f5e85b1c68d78ee0296e (diff)
downloadgitlab-ce-67ffe3ced0a704d78f528e5dc8ea4243e5e4a47f.tar.gz
Merge branch 'fix-embeds-cache' into 'master'
Ensure default metrics embed is cached See merge request gitlab-org/gitlab-ce!31157
-rw-r--r--app/services/metrics/dashboard/default_embed_service.rb2
-rw-r--r--spec/services/metrics/dashboard/default_embed_service_spec.rb6
2 files changed, 5 insertions, 3 deletions
diff --git a/app/services/metrics/dashboard/default_embed_service.rb b/app/services/metrics/dashboard/default_embed_service.rb
index 0967c5bcfeb..8b01b44fc98 100644
--- a/app/services/metrics/dashboard/default_embed_service.rb
+++ b/app/services/metrics/dashboard/default_embed_service.rb
@@ -23,7 +23,7 @@ module Metrics
# Returns a new dashboard with only the matching
# metrics from the system dashboard, stripped of groups.
# @return [Hash]
- def raw_dashboard
+ def get_raw_dashboard
panels = panel_groups.each_with_object([]) do |group, panels|
matched_panels = group['panels'].select { |panel| matching_panel?(panel) }
diff --git a/spec/services/metrics/dashboard/default_embed_service_spec.rb b/spec/services/metrics/dashboard/default_embed_service_spec.rb
index 5b24b9b2a14..803b9a93be7 100644
--- a/spec/services/metrics/dashboard/default_embed_service_spec.rb
+++ b/spec/services/metrics/dashboard/default_embed_service_spec.rb
@@ -14,14 +14,16 @@ describe Metrics::Dashboard::DefaultEmbedService, :use_clean_rails_memory_store_
end
describe '#get_dashboard' do
- let(:service_params) { [project, user, { environment: environment, dashboard_path: nil }] }
+ let(:service_params) { [project, user, { environment: environment }] }
let(:service_call) { described_class.new(*service_params).get_dashboard }
it_behaves_like 'valid embedded dashboard service response'
it_behaves_like 'raises error for users with insufficient permissions'
it 'caches the unprocessed dashboard for subsequent calls' do
- expect(YAML).to receive(:safe_load).once.and_call_original
+ system_service = Metrics::Dashboard::SystemDashboardService
+
+ expect(system_service).to receive(:new).once.and_call_original
described_class.new(*service_params).get_dashboard
described_class.new(*service_params).get_dashboard