Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-13 18:08:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-13 18:08:52 +0300
commit0ab47b994caa80c5587f33dc818626b66cfdafe2 (patch)
tree5ef3976d2f84e3368903a67ba2dbd87a74b9a43c /spec/lib/gitlab/metrics
parent1308dc5eb484ab0f8064989fc551ebdb4b1a7976 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/metrics')
-rw-r--r--spec/lib/gitlab/metrics/dashboard/finder_spec.rb34
-rw-r--r--spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb6
2 files changed, 40 insertions, 0 deletions
diff --git a/spec/lib/gitlab/metrics/dashboard/finder_spec.rb b/spec/lib/gitlab/metrics/dashboard/finder_spec.rb
index 697bedf7362..2d3b61e61ce 100644
--- a/spec/lib/gitlab/metrics/dashboard/finder_spec.rb
+++ b/spec/lib/gitlab/metrics/dashboard/finder_spec.rb
@@ -44,6 +44,12 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi
it_behaves_like 'valid dashboard service response'
end
+ context 'when the self monitoring dashboard is specified' do
+ let(:dashboard_path) { self_monitoring_dashboard_path }
+
+ it_behaves_like 'valid dashboard service response'
+ end
+
context 'when no dashboard is specified' do
let(:service_call) { described_class.find(project, user, environment: environment) }
@@ -152,5 +158,33 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi
expect(all_dashboard_paths).to contain_exactly(system_dashboard, project_dashboard)
end
end
+
+ context 'when the project is self monitoring' do
+ let(:self_monitoring_dashboard) do
+ {
+ path: self_monitoring_dashboard_path,
+ display_name: 'Default',
+ default: true,
+ system_dashboard: false
+ }
+ end
+ let(:dashboard_path) { '.gitlab/dashboards/test.yml' }
+ let(:project) { project_with_dashboard(dashboard_path) }
+
+ before do
+ stub_application_setting(self_monitoring_project_id: project.id)
+ end
+
+ it 'includes self monitoring and project dashboards' do
+ project_dashboard = {
+ path: dashboard_path,
+ display_name: 'test.yml',
+ default: false,
+ system_dashboard: false
+ }
+
+ expect(all_dashboard_paths).to contain_exactly(self_monitoring_dashboard, project_dashboard)
+ end
+ end
end
end
diff --git a/spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb b/spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb
index e0c8133994b..c0d71bfe5d0 100644
--- a/spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb
+++ b/spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb
@@ -30,6 +30,12 @@ describe Gitlab::Metrics::Dashboard::ServiceSelector do
end
end
+ context 'when the path is for the self monitoring dashboard' do
+ let(:arguments) { { dashboard_path: self_monitoring_dashboard_path } }
+
+ it { is_expected.to be Metrics::Dashboard::SelfMonitoringDashboardService }
+ end
+
context 'when the embedded flag is provided' do
let(:arguments) { { embedded: true } }