2019-03-30 07:15:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-06 05:16:26 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2019-01-17 01:53:50 +00:00
|
|
|
describe HashedStorage::MigratorWorker do
|
2017-09-06 05:16:26 +00:00
|
|
|
subject(:worker) { described_class.new }
|
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
|
2019-01-17 01:53:50 +00:00
|
|
|
expect_any_instance_of(Gitlab::HashedStorage::Migrator).to receive(:bulk_migrate).with(start: 5, finish: 10)
|
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
|
|
|
|
|
2018-06-07 15:40:44 +00:00
|
|
|
it 'migrates projects in the specified range' 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
|