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-07-20 15:26:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 15:26:25 +0300
commita09983ae35713f5a2bbb100981116d31ce99826e (patch)
tree2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb
parent18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff)
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb')
-rw-r--r--spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb42
1 files changed, 41 insertions, 1 deletions
diff --git a/spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb b/spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb
index 245c98cdd00..f3c8209e0b6 100644
--- a/spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb
+++ b/spec/lib/gitlab/metrics/dashboard/service_selector_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Gitlab::Metrics::Dashboard::ServiceSelector do
+RSpec.describe Gitlab::Metrics::Dashboard::ServiceSelector do
include MetricsDashboardHelpers
describe '#call' do
@@ -109,6 +109,46 @@ describe Gitlab::Metrics::Dashboard::ServiceSelector do
it { is_expected.to be Metrics::Dashboard::TransientEmbedService }
end
+
+ context 'when cluster is provided' do
+ let(:arguments) { { cluster: "some cluster" } }
+
+ it { is_expected.to be Metrics::Dashboard::ClusterDashboardService }
+ end
+
+ context 'when cluster is provided and embedded is not true' do
+ let(:arguments) { { cluster: "some cluster", embedded: 'false' } }
+
+ it { is_expected.to be Metrics::Dashboard::ClusterDashboardService }
+ end
+
+ context 'when cluster dashboard_path is provided' do
+ let(:arguments) { { dashboard_path: ::Metrics::Dashboard::ClusterDashboardService::DASHBOARD_PATH } }
+
+ it { is_expected.to be Metrics::Dashboard::ClusterDashboardService }
+ end
+
+ context 'when cluster is provided and embed params' do
+ let(:arguments) do
+ {
+ cluster: "some cluster",
+ embedded: 'true',
+ cluster_type: 'project',
+ format: :json,
+ group: 'Food metrics',
+ title: 'Pizza Consumption',
+ y_label: 'Slice Count'
+ }
+ end
+
+ it { is_expected.to be Metrics::Dashboard::ClusterMetricsEmbedService }
+ end
+
+ context 'when metrics embed is for an alert' do
+ let(:arguments) { { embedded: true, prometheus_alert_id: 5 } }
+
+ it { is_expected.to be Metrics::Dashboard::GitlabAlertEmbedService }
+ end
end
end
end