diff options
Diffstat (limited to 'spec/services/metrics/dashboard/system_dashboard_service_spec.rb')
-rw-r--r-- | spec/services/metrics/dashboard/system_dashboard_service_spec.rb | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/spec/services/metrics/dashboard/system_dashboard_service_spec.rb b/spec/services/metrics/dashboard/system_dashboard_service_spec.rb index 7d58501ae3f..ced7c29b507 100644 --- a/spec/services/metrics/dashboard/system_dashboard_service_spec.rb +++ b/spec/services/metrics/dashboard/system_dashboard_service_spec.rb @@ -2,29 +2,39 @@ require 'spec_helper' -describe Metrics::Dashboard::SystemDashboardService, :use_clean_rails_memory_store_caching do +RSpec.describe Metrics::Dashboard::SystemDashboardService, :use_clean_rails_memory_store_caching do include MetricsDashboardHelpers let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project) } let_it_be(:environment) { create(:environment, project: project) } + let(:dashboard_path) { described_class::DASHBOARD_PATH } + let(:service_params) { [project, user, { environment: environment, dashboard_path: dashboard_path }] } + + subject { described_class.new(*service_params) } + before do project.add_maintainer(user) end + describe '#raw_dashboard' do + it_behaves_like '#raw_dashboard raises error if dashboard loading fails' + end + describe '#get_dashboard' do - let(:dashboard_path) { described_class::DASHBOARD_PATH } - let(:service_params) { [project, user, { environment: environment, dashboard_path: dashboard_path }] } let(:service_call) { subject.get_dashboard } - subject { described_class.new(*service_params) } - it_behaves_like 'valid dashboard service response' it_behaves_like 'raises error for users with insufficient permissions' it_behaves_like 'caches the unprocessed dashboard for subsequent calls' + it_behaves_like 'refreshes cache when dashboard_version is changed' it_behaves_like 'updates gitlab_metrics_dashboard_processing_time_ms metric' + it_behaves_like 'dashboard_version contains SHA256 hash of dashboard file content' do + let(:dashboard_version) { subject.send(:dashboard_version) } + end + context 'when called with a non-system dashboard' do let(:dashboard_path) { 'garbage/dashboard/path' } @@ -42,7 +52,8 @@ describe Metrics::Dashboard::SystemDashboardService, :use_clean_rails_memory_sto path: described_class::DASHBOARD_PATH, display_name: described_class::DASHBOARD_NAME, default: true, - system_dashboard: true + system_dashboard: true, + out_of_the_box_dashboard: true }] ) end |