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>2022-01-20 12:16:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 12:16:11 +0300
commitedaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch)
tree11f143effbfeba52329fb7afbd05e6e2a3790241 /spec/workers/metrics
parentd8a5691316400a0f7ec4f83832698f1988eb27c1 (diff)
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'spec/workers/metrics')
-rw-r--r--spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb30
1 files changed, 24 insertions, 6 deletions
diff --git a/spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb b/spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb
index 19b79835825..f151780ffd7 100644
--- a/spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb
+++ b/spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb
@@ -10,16 +10,34 @@ RSpec.describe Metrics::Dashboard::SyncDashboardsWorker do
let(:dashboard_path) { '.gitlab/dashboards/test.yml' }
describe ".perform" do
- it 'imports metrics' do
- expect { worker.perform(project.id) }.to change(PrometheusMetric, :count).by(3)
+ context 'with valid dashboard hash' do
+ it 'imports metrics' do
+ expect { worker.perform(project.id) }.to change(PrometheusMetric, :count).by(3)
+ end
+
+ it 'is idempotent' do
+ 2.times do
+ worker.perform(project.id)
+ end
+
+ expect(PrometheusMetric.count).to eq(3)
+ end
end
- it 'is idempotent' do
- 2.times do
- worker.perform(project.id)
+ context 'with invalid dashboard hash' do
+ before do
+ allow_next_instance_of(Gitlab::Metrics::Dashboard::Importer) do |instance|
+ allow(instance).to receive(:dashboard_hash).and_return({})
+ end
end
- expect(PrometheusMetric.count).to eq(3)
+ it 'does not import metrics' do
+ expect { worker.perform(project.id) }.not_to change(PrometheusMetric, :count)
+ end
+
+ it 'does not raise an error' do
+ expect { worker.perform(project.id) }.not_to raise_error
+ end
end
end
end