diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-02 09:08:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-02 09:08:14 +0000 |
commit | ade18c9d68d5a2e6c6e28ef7e9d3add3b3491ace (patch) | |
tree | cf4154332fc95283f58cccb1383e43b40485d91d /spec/services | |
parent | ba836d98593d68d8d6c22c540e31c8031a786bd8 (diff) | |
download | gitlab-ce-ade18c9d68d5a2e6c6e28ef7e9d3add3b3491ace.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
4 files changed, 24 insertions, 4 deletions
diff --git a/spec/services/metrics/dashboard/custom_dashboard_service_spec.rb b/spec/services/metrics/dashboard/custom_dashboard_service_spec.rb index 9458df3dca0..4966b83bbab 100644 --- a/spec/services/metrics/dashboard/custom_dashboard_service_spec.rb +++ b/spec/services/metrics/dashboard/custom_dashboard_service_spec.rb @@ -16,10 +16,20 @@ describe Metrics::Dashboard::CustomDashboardService, :use_clean_rails_memory_sto describe '#get_dashboard' do let(:dashboard_path) { '.gitlab/dashboards/test.yml' } let(:service_params) { [project, user, { environment: environment, dashboard_path: dashboard_path }] } - let(:service_call) { described_class.new(*service_params).get_dashboard } + let(:service_call) { subject.get_dashboard } + + subject { described_class.new(*service_params) } context 'when the dashboard does not exist' do it_behaves_like 'misconfigured dashboard service response', :not_found + + it 'does not update gitlab_metrics_dashboard_processing_time_ms metric', :prometheus do + service_call + metric = subject.send(:processing_time_metric) + labels = subject.send(:processing_time_metric_labels) + + expect(metric.get(labels)).to eq(0) + end end it_behaves_like 'raises error for users with insufficient permissions' @@ -28,6 +38,7 @@ describe Metrics::Dashboard::CustomDashboardService, :use_clean_rails_memory_sto let(:project) { project_with_dashboard(dashboard_path) } it_behaves_like 'valid dashboard service response' + it_behaves_like 'updates gitlab_metrics_dashboard_processing_time_ms metric' it 'caches the unprocessed dashboard for subsequent calls' do expect_any_instance_of(described_class) diff --git a/spec/services/metrics/dashboard/pod_dashboard_service_spec.rb b/spec/services/metrics/dashboard/pod_dashboard_service_spec.rb index 36ca6f882fa..1e62a5504a9 100644 --- a/spec/services/metrics/dashboard/pod_dashboard_service_spec.rb +++ b/spec/services/metrics/dashboard/pod_dashboard_service_spec.rb @@ -36,9 +36,12 @@ describe Metrics::Dashboard::PodDashboardService, :use_clean_rails_memory_store_ 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) { described_class.new(*service_params).get_dashboard } + let(:service_call) { subject.get_dashboard } + + subject { described_class.new(*service_params) } it_behaves_like 'valid dashboard service response' it_behaves_like 'caches the unprocessed dashboard for subsequent calls' + it_behaves_like 'updates gitlab_metrics_dashboard_processing_time_ms metric' end end diff --git a/spec/services/metrics/dashboard/self_monitoring_dashboard_service_spec.rb b/spec/services/metrics/dashboard/self_monitoring_dashboard_service_spec.rb index 9ee5b06b410..6c9a380a470 100644 --- a/spec/services/metrics/dashboard/self_monitoring_dashboard_service_spec.rb +++ b/spec/services/metrics/dashboard/self_monitoring_dashboard_service_spec.rb @@ -16,11 +16,14 @@ describe Metrics::Dashboard::SelfMonitoringDashboardService, :use_clean_rails_me describe '#get_dashboard' do let(:service_params) { [project, user, { environment: environment }] } - let(:service_call) { described_class.new(*service_params).get_dashboard } + 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 'updates gitlab_metrics_dashboard_processing_time_ms metric' end describe '.all_dashboard_paths' do diff --git a/spec/services/metrics/dashboard/system_dashboard_service_spec.rb b/spec/services/metrics/dashboard/system_dashboard_service_spec.rb index 1956f9b563b..7d58501ae3f 100644 --- a/spec/services/metrics/dashboard/system_dashboard_service_spec.rb +++ b/spec/services/metrics/dashboard/system_dashboard_service_spec.rb @@ -16,11 +16,14 @@ describe Metrics::Dashboard::SystemDashboardService, :use_clean_rails_memory_sto 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) { described_class.new(*service_params).get_dashboard } + 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 'updates gitlab_metrics_dashboard_processing_time_ms metric' context 'when called with a non-system dashboard' do let(:dashboard_path) { 'garbage/dashboard/path' } |