Skip to content
Snippets Groups Projects
Commit 74563593 authored by Sarah Yasonik's avatar Sarah Yasonik Committed by James Lopez
Browse files

Ensure default metrics embed is cached

parent af9b1ffa
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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) }
 
Loading
Loading
Loading
Loading
@@ -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
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