2019-03-30 07:15:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-06 05:16:26 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 15:08:50 +00:00
|
|
|
RSpec.describe HashedStorage::MigratorWorker do
|
2017-09-06 05:16:26 +00:00
|
|
|
subject(:worker) { described_class.new }
|
2019-10-18 11:11:44 +00:00
|
|
|
|
2018-06-07 15:40:44 +00:00
|
|
|
let(:projects) { create_list(:project, 2, :legacy_storage, :empty_repo) }
|
|
|
|
let(:ids) { projects.map(&:id) }
|
2017-09-06 05:16:26 +00:00
|
|
|
|
|
|
|
describe '#perform' do
|
2018-06-07 15:40:44 +00:00
|
|
|
it 'delegates to MigratorService' do
|
2020-01-17 21:08:29 +00:00
|
|
|
expect_next_instance_of(Gitlab::HashedStorage::Migrator) do |instance|
|
|
|
|
expect(instance).to receive(:bulk_migrate).with(start: 5, finish: 10)
|
|
|
|
end
|
2017-09-06 05:16:26 +00:00
|
|
|
|
2018-06-07 15:40:44 +00:00
|
|
|
worker.perform(5, 10)
|
2017-09-06 05:16:26 +00:00
|
|
|
end
|
|
|
|
|
2019-10-23 09:06:03 +00:00
|
|
|
it 'migrates projects in the specified range', :sidekiq_might_not_need_inline do
|
2018-07-23 04:34:54 +00:00
|
|
|
perform_enqueued_jobs do
|
2018-06-07 15:40:44 +00:00
|
|
|
worker.perform(ids.min, ids.max)
|
|
|
|
end
|
2017-09-06 05:16:26 +00:00
|
|
|
|
|
|
|
projects.each do |project|
|
2018-06-07 15:40:44 +00:00
|
|
|
expect(project.reload.hashed_storage?(:attachments)).to be_truthy
|
2017-09-06 05:16:26 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|