diff options
Diffstat (limited to 'spec/workers/concerns')
16 files changed, 16 insertions, 57 deletions
diff --git a/spec/workers/concerns/application_worker_spec.rb b/spec/workers/concerns/application_worker_spec.rb index 087a36d2bd0..a18b83f199b 100644 --- a/spec/workers/concerns/application_worker_spec.rb +++ b/spec/workers/concerns/application_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ApplicationWorker do +RSpec.describe ApplicationWorker do let_it_be(:worker) do Class.new do def self.name diff --git a/spec/workers/concerns/cluster_queue_spec.rb b/spec/workers/concerns/cluster_queue_spec.rb index 732d55dfbde..c03ca9cea48 100644 --- a/spec/workers/concerns/cluster_queue_spec.rb +++ b/spec/workers/concerns/cluster_queue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ClusterQueue do +RSpec.describe ClusterQueue do let(:worker) do Class.new do def self.name diff --git a/spec/workers/concerns/cronjob_queue_spec.rb b/spec/workers/concerns/cronjob_queue_spec.rb index 0cea67bf116..d1ad5c65ea3 100644 --- a/spec/workers/concerns/cronjob_queue_spec.rb +++ b/spec/workers/concerns/cronjob_queue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe CronjobQueue do +RSpec.describe CronjobQueue do let(:worker) do Class.new do def self.name diff --git a/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb b/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb index 51b685b5792..d0cbc6b35e2 100644 --- a/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::GithubImport::ObjectImporter do +RSpec.describe Gitlab::GithubImport::ObjectImporter do let(:worker) do Class.new do def self.name diff --git a/spec/workers/concerns/gitlab/github_import/queue_spec.rb b/spec/workers/concerns/gitlab/github_import/queue_spec.rb index d262bc2e05c..beca221b593 100644 --- a/spec/workers/concerns/gitlab/github_import/queue_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/queue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::GithubImport::Queue do +RSpec.describe Gitlab::GithubImport::Queue do it 'sets the Sidekiq options for the worker' do worker = Class.new do def self.name diff --git a/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb b/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb index c4f6ddf9aca..09d64fe50bd 100644 --- a/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::GithubImport::ReschedulingMethods do +RSpec.describe Gitlab::GithubImport::ReschedulingMethods do let(:worker) do Class.new { include(Gitlab::GithubImport::ReschedulingMethods) }.new end diff --git a/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb b/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb index f9081a875b5..b7635748498 100644 --- a/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::GithubImport::StageMethods do +RSpec.describe Gitlab::GithubImport::StageMethods do let(:project) { create(:project) } let(:worker) do Class.new { include(Gitlab::GithubImport::StageMethods) }.new diff --git a/spec/workers/concerns/gitlab/notify_upon_death_spec.rb b/spec/workers/concerns/gitlab/notify_upon_death_spec.rb index 1c75ac99227..dd0a1cadc9c 100644 --- a/spec/workers/concerns/gitlab/notify_upon_death_spec.rb +++ b/spec/workers/concerns/gitlab/notify_upon_death_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::NotifyUponDeath do +RSpec.describe Gitlab::NotifyUponDeath do let(:worker_class) do Class.new do include Sidekiq::Worker diff --git a/spec/workers/concerns/pipeline_background_queue_spec.rb b/spec/workers/concerns/pipeline_background_queue_spec.rb index 78ceafb359f..77c7e7440c5 100644 --- a/spec/workers/concerns/pipeline_background_queue_spec.rb +++ b/spec/workers/concerns/pipeline_background_queue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe PipelineBackgroundQueue do +RSpec.describe PipelineBackgroundQueue do let(:worker) do Class.new do def self.name diff --git a/spec/workers/concerns/pipeline_queue_spec.rb b/spec/workers/concerns/pipeline_queue_spec.rb index eedfceb8bf0..6c1ac2052e4 100644 --- a/spec/workers/concerns/pipeline_queue_spec.rb +++ b/spec/workers/concerns/pipeline_queue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe PipelineQueue do +RSpec.describe PipelineQueue do let(:worker) do Class.new do def self.name diff --git a/spec/workers/concerns/project_export_options_spec.rb b/spec/workers/concerns/project_export_options_spec.rb deleted file mode 100644 index 985afaaf11e..00000000000 --- a/spec/workers/concerns/project_export_options_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe ProjectExportOptions do - let(:project) { create(:project) } - let(:project_export_job) { create(:project_export_job, project: project, jid: '123', status: 1) } - let(:job) { { 'args' => [project.owner.id, project.id, nil, nil], 'jid' => '123' } } - let(:worker_class) do - Class.new do - include Sidekiq::Worker - include ProjectExportOptions - end - end - - it 'sets default retry limit' do - expect(worker_class.sidekiq_options['retry']).to eq(ProjectExportOptions::EXPORT_RETRY_COUNT) - end - - it 'sets default status expiration' do - expect(worker_class.sidekiq_options['status_expiration']).to eq(StuckExportJobsWorker::EXPORT_JOBS_EXPIRATION) - end - - describe '.sidekiq_retries_exhausted' do - it 'marks status as failed' do - expect { worker_class.sidekiq_retries_exhausted_block.call(job) }.to change { project_export_job.reload.status }.from(1).to(3) - end - - context 'when status update fails' do - before do - project_export_job.update(status: 2) - end - - it 'logs an error' do - expect(Sidekiq.logger).to receive(:error).with("Failed to set Job #{job['jid']} for project #{project.id} to failed state") - - worker_class.sidekiq_retries_exhausted_block.call(job) - end - end - end -end diff --git a/spec/workers/concerns/project_import_options_spec.rb b/spec/workers/concerns/project_import_options_spec.rb index c56dcc5ed82..85a26ddb0cb 100644 --- a/spec/workers/concerns/project_import_options_spec.rb +++ b/spec/workers/concerns/project_import_options_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ProjectImportOptions do +RSpec.describe ProjectImportOptions do let(:project) { create(:project, :import_started) } let(:job) { { 'args' => [project.id, nil, nil], 'jid' => '123' } } let(:worker_class) do diff --git a/spec/workers/concerns/reenqueuer_spec.rb b/spec/workers/concerns/reenqueuer_spec.rb index b28f83d211b..df0724045c1 100644 --- a/spec/workers/concerns/reenqueuer_spec.rb +++ b/spec/workers/concerns/reenqueuer_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Reenqueuer do +RSpec.describe Reenqueuer do include ExclusiveLeaseHelpers let_it_be(:worker_class) do @@ -93,7 +93,7 @@ describe Reenqueuer do end end -describe Reenqueuer::ReenqueuerSleeper do +RSpec.describe Reenqueuer::ReenqueuerSleeper do let_it_be(:dummy_class) do Class.new do include Reenqueuer::ReenqueuerSleeper diff --git a/spec/workers/concerns/repository_check_queue_spec.rb b/spec/workers/concerns/repository_check_queue_spec.rb index 55ed71f124c..ae377c09b37 100644 --- a/spec/workers/concerns/repository_check_queue_spec.rb +++ b/spec/workers/concerns/repository_check_queue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RepositoryCheckQueue do +RSpec.describe RepositoryCheckQueue do let(:worker) do Class.new do def self.name diff --git a/spec/workers/concerns/waitable_worker_spec.rb b/spec/workers/concerns/waitable_worker_spec.rb index e7ef96c685d..5d08d38380a 100644 --- a/spec/workers/concerns/waitable_worker_spec.rb +++ b/spec/workers/concerns/waitable_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe WaitableWorker do +RSpec.describe WaitableWorker do let(:worker) do Class.new do def self.name diff --git a/spec/workers/concerns/worker_context_spec.rb b/spec/workers/concerns/worker_context_spec.rb index 4e8c81c57dc..3de37b99aba 100644 --- a/spec/workers/concerns/worker_context_spec.rb +++ b/spec/workers/concerns/worker_context_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe WorkerContext do +RSpec.describe WorkerContext do let(:worker) do Class.new do def self.name |