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>2023-05-29 09:08:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-29 09:08:28 +0300
commitbceef0b492c1f4bc15c21c70cbe7aef34385a3da (patch)
tree96bdf77524803477dd3959de21a5548c6f554d4d /spec/workers
parentced01fb79233c18bc05748804ede24591c04cf49 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/clusters/integrations/check_prometheus_health_worker_spec.rb19
-rw-r--r--spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb41
-rw-r--r--spec/workers/metrics/dashboard/schedule_annotations_prune_worker_spec.rb13
-rw-r--r--spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb43
4 files changed, 0 insertions, 116 deletions
diff --git a/spec/workers/clusters/integrations/check_prometheus_health_worker_spec.rb b/spec/workers/clusters/integrations/check_prometheus_health_worker_spec.rb
deleted file mode 100644
index 1f5892a36da..00000000000
--- a/spec/workers/clusters/integrations/check_prometheus_health_worker_spec.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Clusters::Integrations::CheckPrometheusHealthWorker, '#perform', feature_category: :incident_management do
- subject { described_class.new.perform }
-
- it 'triggers health service' do
- cluster = create(:cluster)
- allow(Gitlab::Monitor::DemoProjects).to receive(:primary_keys)
- allow(Clusters::Cluster).to receive_message_chain(:with_integration_prometheus, :with_project_http_integrations).and_return([cluster])
-
- service_instance = instance_double(Clusters::Integrations::PrometheusHealthCheckService)
- expect(Clusters::Integrations::PrometheusHealthCheckService).to receive(:new).with(cluster).and_return(service_instance)
- expect(service_instance).to receive(:execute)
-
- subject
- end
-end
diff --git a/spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb b/spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb
deleted file mode 100644
index c7e2bbc2ad9..00000000000
--- a/spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Metrics::Dashboard::PruneOldAnnotationsWorker, feature_category: :metrics do
- let_it_be(:now) { DateTime.parse('2020-06-02T00:12:00Z') }
- let_it_be(:two_weeks_old_annotation) { create(:metrics_dashboard_annotation, starting_at: now.advance(weeks: -2)) }
- let_it_be(:one_day_old_annotation) { create(:metrics_dashboard_annotation, starting_at: now.advance(days: -1)) }
- let_it_be(:month_old_annotation) { create(:metrics_dashboard_annotation, starting_at: now.advance(months: -1)) }
-
- describe '#perform' do
- it 'removes all annotations older than cut off', :aggregate_failures do
- travel_to(now) do
- described_class.new.perform
-
- expect(Metrics::Dashboard::Annotation.all).to match_array([one_day_old_annotation, two_weeks_old_annotation])
-
- # is idempotent in the scope of 24h
- expect { described_class.new.perform }.not_to change { Metrics::Dashboard::Annotation.all.to_a }
- end
-
- travel_to(now + 24.hours) do
- described_class.new.perform
- expect(Metrics::Dashboard::Annotation.all).to match_array([one_day_old_annotation])
- end
- end
-
- context 'batch to be deleted is bigger than upper limit' do
- it 'schedules second job to clear remaining records' do
- travel_to(now) do
- create(:metrics_dashboard_annotation, starting_at: 1.month.ago)
- stub_const("#{described_class}::DELETE_LIMIT", 1)
-
- expect(described_class).to receive(:perform_async)
-
- described_class.new.perform
- end
- end
- end
- end
-end
diff --git a/spec/workers/metrics/dashboard/schedule_annotations_prune_worker_spec.rb b/spec/workers/metrics/dashboard/schedule_annotations_prune_worker_spec.rb
deleted file mode 100644
index 75866a4eca2..00000000000
--- a/spec/workers/metrics/dashboard/schedule_annotations_prune_worker_spec.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Metrics::Dashboard::ScheduleAnnotationsPruneWorker, feature_category: :metrics do
- describe '#perform' do
- it 'schedules annotations prune job with default cut off date' do
- expect(Metrics::Dashboard::PruneOldAnnotationsWorker).to receive(:perform_async)
-
- described_class.new.perform
- end
- end
-end
diff --git a/spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb b/spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb
deleted file mode 100644
index f7d67b2064e..00000000000
--- a/spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Metrics::Dashboard::SyncDashboardsWorker, feature_category: :metrics do
- include MetricsDashboardHelpers
- subject(:worker) { described_class.new }
-
- let(:project) { project_with_dashboard(dashboard_path) }
- let(:dashboard_path) { '.gitlab/dashboards/test.yml' }
-
- describe ".perform" do
- 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
-
- 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
-
- 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