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-04-15 15:09:18 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-15 15:09:18 +0300
commitb7c735c8ac11b8182807070fc6f84f2606e15427 (patch)
treee74b4d25abb8bbf23546f001dd94515e2840a3a3 /spec/lib/gitlab/metrics
parent221b529789f4090341a825695aeb49b8df6dd11d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/metrics')
-rw-r--r--spec/lib/gitlab/metrics/dashboard/processor_spec.rb17
-rw-r--r--spec/lib/gitlab/metrics/dashboard/stages/panel_ids_inserter_spec.rb19
2 files changed, 32 insertions, 4 deletions
diff --git a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb
index 3cb02a8bcb3..b2fca0b5954 100644
--- a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb
+++ b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb
@@ -15,7 +15,8 @@ describe Gitlab::Metrics::Dashboard::Processor do
Gitlab::Metrics::Dashboard::Stages::CustomMetricsDetailsInserter,
Gitlab::Metrics::Dashboard::Stages::EndpointInserter,
Gitlab::Metrics::Dashboard::Stages::Sorter,
- Gitlab::Metrics::Dashboard::Stages::AlertsInserter
+ Gitlab::Metrics::Dashboard::Stages::AlertsInserter,
+ Gitlab::Metrics::Dashboard::Stages::PanelIdsInserter
]
end
@@ -28,6 +29,12 @@ describe Gitlab::Metrics::Dashboard::Processor do
end
end
+ it 'includes an id for each dashboard panel' do
+ expect(all_panels).to satisfy_all do |panel|
+ panel[:id].present?
+ end
+ end
+
it 'includes boolean to indicate if panel group has custom metrics' do
expect(dashboard[:panel_groups]).to all(include( { has_custom_metrics: boolean } ))
end
@@ -199,9 +206,11 @@ describe Gitlab::Metrics::Dashboard::Processor do
private
def all_metrics
- dashboard[:panel_groups].flat_map do |group|
- group[:panels].flat_map { |panel| panel[:metrics] }
- end
+ all_panels.flat_map { |panel| panel[:metrics] }
+ end
+
+ def all_panels
+ dashboard[:panel_groups].flat_map { |group| group[:panels] }
end
def get_metric_details(metric)
diff --git a/spec/lib/gitlab/metrics/dashboard/stages/panel_ids_inserter_spec.rb b/spec/lib/gitlab/metrics/dashboard/stages/panel_ids_inserter_spec.rb
index 426a54bea78..6124f471e39 100644
--- a/spec/lib/gitlab/metrics/dashboard/stages/panel_ids_inserter_spec.rb
+++ b/spec/lib/gitlab/metrics/dashboard/stages/panel_ids_inserter_spec.rb
@@ -63,5 +63,24 @@ describe Gitlab::Metrics::Dashboard::Stages::PanelIdsInserter do
)
end
end
+
+ context 'when dashboard panels has unknown schema attributes' do
+ before do
+ error = ActiveModel::UnknownAttributeError.new(double, 'unknown_panel_attribute')
+ allow(::PerformanceMonitoring::PrometheusPanel).to receive(:new).and_raise(error)
+ end
+
+ it 'no panel has assigned id' do
+ transform!
+
+ expect(fetch_panel_ids(dashboard)).to all be_nil
+ end
+
+ it 'logs the failure' do
+ expect(Gitlab::ErrorTracking).to receive(:log_exception)
+
+ transform!
+ end
+ end
end
end