diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2019-01-17 04:53:50 +0300 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2019-01-25 22:26:35 +0300 |
commit | 7bc16889df458865ffbbb7bef8087c04a5768a1d (patch) | |
tree | 23842ae1d6de742eb8064f196e39dd90c179bd7c /spec/workers/hashed_storage | |
parent | b88f27c8d1cb44201490bf51db143f4267735775 (diff) |
Refactor Storage Migration
Specs were reviewed and improved to better cover the current behavior.
There was some standardization done as well to facilitate the
implementation of the rollback functionality.
StorageMigratorWorker was extracted to HashedStorage namespace were
RollbackerWorker will live one as well.
Diffstat (limited to 'spec/workers/hashed_storage')
-rw-r--r-- | spec/workers/hashed_storage/migrator_worker_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/workers/hashed_storage/migrator_worker_spec.rb b/spec/workers/hashed_storage/migrator_worker_spec.rb new file mode 100644 index 00000000000..a85f820a3eb --- /dev/null +++ b/spec/workers/hashed_storage/migrator_worker_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe HashedStorage::MigratorWorker do + subject(:worker) { described_class.new } + let(:projects) { create_list(:project, 2, :legacy_storage, :empty_repo) } + let(:ids) { projects.map(&:id) } + + describe '#perform' do + it 'delegates to MigratorService' do + expect_any_instance_of(Gitlab::HashedStorage::Migrator).to receive(:bulk_migrate).with(start: 5, finish: 10) + + worker.perform(5, 10) + end + + it 'migrates projects in the specified range' do + perform_enqueued_jobs do + worker.perform(ids.min, ids.max) + end + + projects.each do |project| + expect(project.reload.hashed_storage?(:attachments)).to be_truthy + end + end + end +end |