提交 4cfe9209 编写于 作者: S Sean McGivern

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
---
title: Migrate any remaining jobs from deprecated `object_storage_upload` queue.
merge_request:
author:
type: deprecated
class MigrateObjectStorageUploadSidekiqQueue < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
sidekiq_queue_migrate 'object_storage_upload', to: 'object_storage:object_storage_background_move'
end
def down
# do not migrate any jobs back because we would migrate also
# jobs which were not part of the 'object_storage_upload'
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180531220618) do
ActiveRecord::Schema.define(version: 20180603190921) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册