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:
authorMicaël Bergeron <mbergeron@gitlab.com>2018-03-29 18:05:05 +0300
committerMicaël Bergeron <mbergeron@gitlab.com>2018-03-29 18:05:05 +0300
commitef10679418f6fca1a0bb8c0f5d57c1550e104183 (patch)
tree76f063d2ff97fde377c865abdb365cb1f61da688
parentc88fe5a31be4d14bf7efbc7ab8aa763678b17967 (diff)
fix rake migration task from ignoring Upload(store: nil)
-rw-r--r--lib/tasks/gitlab/uploads/migrate.rake4
-rw-r--r--spec/tasks/gitlab/uploads/migrate_rake_spec.rb17
2 files changed, 16 insertions, 5 deletions
diff --git a/lib/tasks/gitlab/uploads/migrate.rake b/lib/tasks/gitlab/uploads/migrate.rake
index c26c3ccb3be..f0f4acd6140 100644
--- a/lib/tasks/gitlab/uploads/migrate.rake
+++ b/lib/tasks/gitlab/uploads/migrate.rake
@@ -25,8 +25,8 @@ namespace :gitlab do
Upload.class_eval { include EachBatch } unless Upload < EachBatch
Upload
- .where.not(store: @to_store)
- .where(uploader: @uploader_class.to_s,
+ .where(store: [nil, 1],
+ uploader: @uploader_class.to_s,
model_type: @model_class.base_class.sti_name)
end
end
diff --git a/spec/tasks/gitlab/uploads/migrate_rake_spec.rb b/spec/tasks/gitlab/uploads/migrate_rake_spec.rb
index b778d26060d..8f93ffa0edd 100644
--- a/spec/tasks/gitlab/uploads/migrate_rake_spec.rb
+++ b/spec/tasks/gitlab/uploads/migrate_rake_spec.rb
@@ -20,9 +20,20 @@ describe 'gitlab:uploads:migrate rake tasks' do
run_rake_task("gitlab:uploads:migrate", *args)
end
- it 'enqueue jobs in batch' do
- expect(ObjectStorage::MigrateUploadsWorker).to receive(:enqueue!).exactly(4).times
+ shared_examples 'enqueue jobs in batch' do |batch:|
+ it do
+ expect(ObjectStorage::MigrateUploadsWorker)
+ .to receive(:enqueue!).exactly(batch).times
- run
+ run
+ end
+ end
+
+ context 'Upload has store = nil' do
+ before do
+ Upload.where(model: projects.first(5)).update_all(store: nil)
+ end
+
+ it_behaves_like 'enqueue jobs in batch', batch: 4
end
end