Commit ef106794 authored by Micaël Bergeron's avatar Micaël Bergeron

fix rake migration task from ignoring Upload(store: nil)

parent c88fe5a3
......@@ -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
......
......@@ -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
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment