Ensure default metrics embed is cached
This commit is contained in:
parent
af9b1ffa75
commit
74563593b9
2 changed files with 5 additions and 3 deletions
|
@ -23,7 +23,7 @@ module Metrics
|
||||||
# Returns a new dashboard with only the matching
|
# Returns a new dashboard with only the matching
|
||||||
# metrics from the system dashboard, stripped of groups.
|
# metrics from the system dashboard, stripped of groups.
|
||||||
# @return [Hash]
|
# @return [Hash]
|
||||||
def raw_dashboard
|
def get_raw_dashboard
|
||||||
panels = panel_groups.each_with_object([]) do |group, panels|
|
panels = panel_groups.each_with_object([]) do |group, panels|
|
||||||
matched_panels = group['panels'].select { |panel| matching_panel?(panel) }
|
matched_panels = group['panels'].select { |panel| matching_panel?(panel) }
|
||||||
|
|
||||||
|
|
|
@ -14,14 +14,16 @@ describe Metrics::Dashboard::DefaultEmbedService, :use_clean_rails_memory_store_
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#get_dashboard' do
|
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 }
|
let(:service_call) { described_class.new(*service_params).get_dashboard }
|
||||||
|
|
||||||
it_behaves_like 'valid embedded dashboard service response'
|
it_behaves_like 'valid embedded dashboard service response'
|
||||||
it_behaves_like 'raises error for users with insufficient permissions'
|
it_behaves_like 'raises error for users with insufficient permissions'
|
||||||
|
|
||||||
it 'caches the unprocessed dashboard for subsequent calls' do
|
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
|
||||||
described_class.new(*service_params).get_dashboard
|
described_class.new(*service_params).get_dashboard
|
||||||
|
|
Loading…
Reference in a new issue