diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-06-06 12:01:07 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-06-06 12:01:07 +0300 |
commit | 4cfe9209106d4697cd8836039e93e0c74708d811 (patch) | |
tree | fc692a117f5227cdc8180132887703e2b70e3518 /spec | |
parent | 930ad88a87b0814173989aaccc6dc8af00d1bf65 (diff) | |
parent | fc916b068199f2624c5b9cfeb0389760448910ff (diff) |
Merge branch 'jprovazn-uploader-migration' into 'master'
Migrate jobs in object_storage_upload queue
Closes gitlab-ee#4811
See merge request gitlab-org/gitlab-ce!19180
Diffstat (limited to 'spec')
-rw-r--r-- | spec/migrations/migrate_object_storage_upload_sidekiq_queue_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/migrations/migrate_object_storage_upload_sidekiq_queue_spec.rb b/spec/migrations/migrate_object_storage_upload_sidekiq_queue_spec.rb new file mode 100644 index 00000000000..1ee6c440cf4 --- /dev/null +++ b/spec/migrations/migrate_object_storage_upload_sidekiq_queue_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' +require Rails.root.join('db', 'post_migrate', '20180603190921_migrate_object_storage_upload_sidekiq_queue.rb') + +describe MigrateObjectStorageUploadSidekiqQueue, :sidekiq, :redis do + include Gitlab::Database::MigrationHelpers + + context 'when there are jobs in the queue' do + it 'correctly migrates queue when migrating up' do + Sidekiq::Testing.disable! do + stubbed_worker(queue: 'object_storage_upload').perform_async('Something', [1]) + stubbed_worker(queue: 'object_storage:object_storage_background_move').perform_async('Something', [1]) + + described_class.new.up + + expect(sidekiq_queue_length('object_storage_upload')).to eq 0 + expect(sidekiq_queue_length('object_storage:object_storage_background_move')).to eq 2 + end + end + end + + context 'when there are no jobs in the queues' do + it 'does not raise error when migrating up' do + expect { described_class.new.up }.not_to raise_error + end + end + + def stubbed_worker(queue:) + Class.new do + include Sidekiq::Worker + sidekiq_options queue: queue + end + end +end |