Commit 15f486e3 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add sidekiq worker shared examples to workers specs

parent 82056644
...@@ -47,4 +47,6 @@ describe AuthorizedProjectsWorker do ...@@ -47,4 +47,6 @@ describe AuthorizedProjectsWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -41,4 +41,6 @@ describe BackgroundMigrationWorker, :sidekiq do ...@@ -41,4 +41,6 @@ describe BackgroundMigrationWorker, :sidekiq do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -36,4 +36,6 @@ describe CreateGpgSignatureWorker do ...@@ -36,4 +36,6 @@ describe CreateGpgSignatureWorker do
described_class.new.perform(anything, nonexisting_project_id) described_class.new.perform(anything, nonexisting_project_id)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -16,4 +16,6 @@ describe DeleteMergedBranchesWorker do ...@@ -16,4 +16,6 @@ describe DeleteMergedBranchesWorker do
expect(worker.perform('unknown', project.owner.id)).to be_falsy expect(worker.perform('unknown', project.owner.id)).to be_falsy
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -17,4 +17,6 @@ describe DeleteUserWorker do ...@@ -17,4 +17,6 @@ describe DeleteUserWorker do
described_class.new.perform(current_user.id, user.id, "test" => "test") described_class.new.perform(current_user.id, user.id, "test" => "test")
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -60,4 +60,6 @@ describe EmailReceiverWorker, :mailer do ...@@ -60,4 +60,6 @@ describe EmailReceiverWorker, :mailer do
described_class.new.perform(raw_message) described_class.new.perform(raw_message)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -127,4 +127,6 @@ describe EmailsOnPushWorker, :mailer do ...@@ -127,4 +127,6 @@ describe EmailsOnPushWorker, :mailer do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -41,4 +41,6 @@ describe 'Every Sidekiq worker' do ...@@ -41,4 +41,6 @@ describe 'Every Sidekiq worker' do
expect(queue_names).to include(worker.sidekiq_options['queue'].to_s) expect(queue_names).to include(worker.sidekiq_options['queue'].to_s)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -47,4 +47,6 @@ describe ExpireBuildArtifactsWorker do ...@@ -47,4 +47,6 @@ describe ExpireBuildArtifactsWorker do
Sidekiq::Queues.jobs_by_worker['ExpireBuildInstanceArtifactsWorker'] Sidekiq::Queues.jobs_by_worker['ExpireBuildInstanceArtifactsWorker']
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -74,4 +74,6 @@ describe ExpireBuildInstanceArtifactsWorker do ...@@ -74,4 +74,6 @@ describe ExpireBuildInstanceArtifactsWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -131,6 +131,8 @@ describe GitGarbageCollectWorker do ...@@ -131,6 +131,8 @@ describe GitGarbageCollectWorker do
end end
end end
it_behaves_like 'sidekiq worker'
# Create a new commit on a random new branch # Create a new commit on a random new branch
def create_objects(project) def create_objects(project)
rugged = project.repository.rugged rugged = project.repository.rugged
......
...@@ -10,4 +10,6 @@ describe GitlabUsagePingWorker do ...@@ -10,4 +10,6 @@ describe GitlabUsagePingWorker do
subject.perform subject.perform
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -16,4 +16,6 @@ describe GroupDestroyWorker do ...@@ -16,4 +16,6 @@ describe GroupDestroyWorker do
expect(Dir.exist?(project.path)).to be_falsey expect(Dir.exist?(project.path)).to be_falsey
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -26,4 +26,6 @@ describe InvalidGpgSignatureUpdateWorker do ...@@ -26,4 +26,6 @@ describe InvalidGpgSignatureUpdateWorker do
described_class.new.perform(nonexisting_gpg_key_id) described_class.new.perform(nonexisting_gpg_key_id)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -38,4 +38,6 @@ describe MergeWorker do ...@@ -38,4 +38,6 @@ describe MergeWorker do
expect { worker.perform(merge_request.id, user.id, {}) } expect { worker.perform(merge_request.id, user.id, {}) }
.to change { merge_request.reload.merge_jid }.from(nil).to('999') .to change { merge_request.reload.merge_jid }.from(nil).to('999')
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -76,4 +76,6 @@ describe NamespacelessProjectDestroyWorker do ...@@ -76,4 +76,6 @@ describe NamespacelessProjectDestroyWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -51,4 +51,6 @@ describe NewIssueWorker do ...@@ -51,4 +51,6 @@ describe NewIssueWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -53,4 +53,6 @@ describe NewMergeRequestWorker do ...@@ -53,4 +53,6 @@ describe NewMergeRequestWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -46,4 +46,6 @@ describe NewNoteWorker do ...@@ -46,4 +46,6 @@ describe NewNoteWorker do
described_class.new.perform(unexistent_note_id) described_class.new.perform(unexistent_note_id)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -62,4 +62,6 @@ describe PipelineScheduleWorker do ...@@ -62,4 +62,6 @@ describe PipelineScheduleWorker do
expect { subject }.not_to change { project.pipelines.count } expect { subject }.not_to change { project.pipelines.count }
end end
end end
it_behaves_like 'sidekiq worker'
end end
require 'spec_helper' require 'spec_helper'
describe PipelineUpdateWorker do describe PipelineUpdateWorker do
it_behaves_like 'sidekiq worker'
describe '#perform' do describe '#perform' do
context 'when pipeline exists' do context 'when pipeline exists' do
let(:pipeline) { create(:ci_pipeline) } let(:pipeline) { create(:ci_pipeline) }
...@@ -21,4 +19,6 @@ describe PipelineUpdateWorker do ...@@ -21,4 +19,6 @@ describe PipelineUpdateWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -140,4 +140,6 @@ describe PostReceive do ...@@ -140,4 +140,6 @@ describe PostReceive do
described_class.new.perform(gl_repository, key_id, base64_changes) described_class.new.perform(gl_repository, key_id, base64_changes)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -134,4 +134,6 @@ describe ProcessCommitWorker do ...@@ -134,4 +134,6 @@ describe ProcessCommitWorker do
expect(commit.authored_date).to be_an_instance_of(Time) expect(commit.authored_date).to be_an_instance_of(Time)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -87,4 +87,6 @@ describe ProjectCacheWorker do ...@@ -87,4 +87,6 @@ describe ProjectCacheWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -33,4 +33,6 @@ describe ProjectDestroyWorker do ...@@ -33,4 +33,6 @@ describe ProjectDestroyWorker do
end.not_to raise_error end.not_to raise_error
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -26,4 +26,6 @@ describe PropagateServiceTemplateWorker do ...@@ -26,4 +26,6 @@ describe PropagateServiceTemplateWorker do
subject.perform(service_template.id) subject.perform(service_template.id)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -23,4 +23,6 @@ describe PruneOldEventsWorker do ...@@ -23,4 +23,6 @@ describe PruneOldEventsWorker do
expect(exactly_12_months_event).to be_present expect(exactly_12_months_event).to be_present
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -12,4 +12,6 @@ describe ReactiveCachingWorker do ...@@ -12,4 +12,6 @@ describe ReactiveCachingWorker do
subject subject
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -21,4 +21,6 @@ describe RemoveExpiredGroupLinksWorker do ...@@ -21,4 +21,6 @@ describe RemoveExpiredGroupLinksWorker do
expect(non_expiring_project_group_link.reload).to be_present expect(non_expiring_project_group_link.reload).to be_present
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -55,4 +55,6 @@ describe RemoveExpiredMembersWorker do ...@@ -55,4 +55,6 @@ describe RemoveExpiredMembersWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -15,4 +15,6 @@ describe RemoveOldWebHookLogsWorker do ...@@ -15,4 +15,6 @@ describe RemoveOldWebHookLogsWorker do
expect(WebHookLog.all).not_to include(week_old_record, three_days_old_record) expect(WebHookLog.all).not_to include(week_old_record, three_days_old_record)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -52,4 +52,6 @@ describe RemoveUnreferencedLfsObjectsWorker do ...@@ -52,4 +52,6 @@ describe RemoveUnreferencedLfsObjectsWorker do
expect(LfsObject.where(id: referenced_lfs_object2.id)).to be_empty expect(LfsObject.where(id: referenced_lfs_object2.id)).to be_empty
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -69,4 +69,6 @@ describe RepositoryForkWorker do ...@@ -69,4 +69,6 @@ describe RepositoryForkWorker do
expect(project.reload.import_status).to eq('failed') expect(project.reload.import_status).to eq('failed')
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -43,4 +43,6 @@ describe RepositoryImportWorker do ...@@ -43,4 +43,6 @@ describe RepositoryImportWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -22,4 +22,6 @@ describe ScheduleUpdateUserActivityWorker, :clean_gitlab_redis_shared_state do ...@@ -22,4 +22,6 @@ describe ScheduleUpdateUserActivityWorker, :clean_gitlab_redis_shared_state do
subject.perform(1) subject.perform(1)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -132,4 +132,6 @@ describe StuckCiJobsWorker do ...@@ -132,4 +132,6 @@ describe StuckCiJobsWorker do
worker.perform worker.perform
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -33,4 +33,6 @@ describe StuckImportJobsWorker do ...@@ -33,4 +33,6 @@ describe StuckImportJobsWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -47,4 +47,6 @@ describe StuckMergeJobsWorker do ...@@ -47,4 +47,6 @@ describe StuckMergeJobsWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -16,4 +16,6 @@ describe SystemHookPushWorker do ...@@ -16,4 +16,6 @@ describe SystemHookPushWorker do
subject.perform(push_data, :push_hooks) subject.perform(push_data, :push_hooks)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -8,4 +8,6 @@ describe TrendingProjectsWorker do ...@@ -8,4 +8,6 @@ describe TrendingProjectsWorker do
described_class.new.perform described_class.new.perform
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -24,4 +24,6 @@ describe UpdateMergeRequestsWorker do ...@@ -24,4 +24,6 @@ describe UpdateMergeRequestsWorker do
perform perform
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -32,4 +32,6 @@ describe UpdateUserActivityWorker, :clean_gitlab_redis_shared_state do ...@@ -32,4 +32,6 @@ describe UpdateUserActivityWorker, :clean_gitlab_redis_shared_state do
expect(Gitlab::UserActivities.new.to_a).to be_empty expect(Gitlab::UserActivities.new.to_a).to be_empty
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -16,4 +16,6 @@ describe UploadChecksumWorker do ...@@ -16,4 +16,6 @@ describe UploadChecksumWorker do
expect(upload).to have_received(:save!) expect(upload).to have_received(:save!)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -20,4 +20,6 @@ describe UseKeyWorker do ...@@ -20,4 +20,6 @@ describe UseKeyWorker do
expect(worker.perform(key.id + 1)).to eq false expect(worker.perform(key.id + 1)).to eq false
end end
end end
it_behaves_like 'sidekiq worker'
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment