diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-20 15:05:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-20 15:05:52 +0300 |
commit | d46287cc16ba244720c6d5c00491944336972988 (patch) | |
tree | bcb8129932d9b734334bfcd67dbcf7b1185d0280 /spec/uploaders | |
parent | 8ac91ecfd1bb445a0a1572b3c0885c41c9037e8a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/uploaders')
-rw-r--r-- | spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb b/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb index da490cb02af..6c2544d2efd 100644 --- a/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb +++ b/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb @@ -11,8 +11,8 @@ describe ObjectStorage::MigrateUploadsWorker, :sidekiq do let(:uploads) { Upload.all } let(:to_store) { ObjectStorage::Store::REMOTE } - def perform(uploads) - described_class.new.perform(uploads.ids, model_class.to_s, mounted_as, to_store) + def perform(uploads, store = nil) + described_class.new.perform(uploads.ids, model_class.to_s, mounted_as, store || to_store) rescue ObjectStorage::MigrateUploadsWorker::Report::MigrationFailures # swallow end @@ -97,12 +97,28 @@ describe ObjectStorage::MigrateUploadsWorker, :sidekiq do it_behaves_like 'outputs correctly', success: 10 - it 'migrates files' do + it 'migrates files to remote storage' do perform(uploads) expect(Upload.where(store: ObjectStorage::Store::LOCAL).count).to eq(0) end + context 'reversed' do + let(:to_store) { ObjectStorage::Store::LOCAL } + + before do + perform(uploads, ObjectStorage::Store::REMOTE) + end + + it 'migrates files to local storage' do + expect(Upload.where(store: ObjectStorage::Store::REMOTE).count).to eq(10) + + perform(uploads) + + expect(Upload.where(store: ObjectStorage::Store::LOCAL).count).to eq(10) + end + end + context 'migration is unsuccessful' do before do allow_any_instance_of(ObjectStorage::Concern) |