Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-20 15:05:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-20 15:05:52 +0300
commitd46287cc16ba244720c6d5c00491944336972988 (patch)
treebcb8129932d9b734334bfcd67dbcf7b1185d0280 /spec/tasks/gitlab/uploads/migrate_rake_spec.rb
parent8ac91ecfd1bb445a0a1572b3c0885c41c9037e8a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tasks/gitlab/uploads/migrate_rake_spec.rb')
-rw-r--r--spec/tasks/gitlab/uploads/migrate_rake_spec.rb25
1 files changed, 18 insertions, 7 deletions
diff --git a/spec/tasks/gitlab/uploads/migrate_rake_spec.rb b/spec/tasks/gitlab/uploads/migrate_rake_spec.rb
index 9588e8be5dc..8d1e355a7d3 100644
--- a/spec/tasks/gitlab/uploads/migrate_rake_spec.rb
+++ b/spec/tasks/gitlab/uploads/migrate_rake_spec.rb
@@ -1,31 +1,42 @@
require 'rake_helper'
-describe 'gitlab:uploads:migrate rake tasks' do
+describe 'gitlab:uploads:migrate and migrate_to_local rake tasks' do
let(:model_class) { nil }
let(:uploader_class) { nil }
let(:mounted_as) { nil }
let(:batch_size) { 3 }
before do
- stub_env('BATCH', batch_size.to_s)
+ stub_env('MIGRATION_BATCH_SIZE', batch_size.to_s)
stub_uploads_object_storage(uploader_class)
Rake.application.rake_require 'tasks/gitlab/uploads/migrate'
allow(ObjectStorage::MigrateUploadsWorker).to receive(:perform_async)
end
- def run
+ def run(task)
args = [uploader_class.to_s, model_class.to_s, mounted_as].compact
- run_rake_task("gitlab:uploads:migrate", *args)
+ run_rake_task(task, *args)
end
shared_examples 'enqueue jobs in batch' do |batch:|
- it do
+ it 'migrates local storage to remote object storage' do
expect(ObjectStorage::MigrateUploadsWorker)
.to receive(:perform_async).exactly(batch).times
- .and_return("A fake job.")
+ .and_return("A fake job.")
- run
+ run('gitlab:uploads:migrate')
+ end
+
+ it 'migrates remote object storage to local storage' do
+ expect(Upload).to receive(:where).exactly(batch + 1).times { Upload.all }
+ expect(ObjectStorage::MigrateUploadsWorker)
+ .to receive(:perform_async)
+ .with(anything, model_class.name, mounted_as, ObjectStorage::Store::LOCAL)
+ .exactly(batch).times
+ .and_return("A fake job.")
+
+ run('gitlab:uploads:migrate_to_local')
end
end