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 ...@@ -25,8 +25,8 @@ namespace :gitlab do
Upload.class_eval { include EachBatch } unless Upload < EachBatch Upload.class_eval { include EachBatch } unless Upload < EachBatch
Upload Upload
.where.not(store: @to_store) .where(store: [nil, 1],
.where(uploader: @uploader_class.to_s, uploader: @uploader_class.to_s,
model_type: @model_class.base_class.sti_name) model_type: @model_class.base_class.sti_name)
end end
end end
......
...@@ -20,9 +20,20 @@ describe 'gitlab:uploads:migrate rake tasks' do ...@@ -20,9 +20,20 @@ describe 'gitlab:uploads:migrate rake tasks' do
run_rake_task("gitlab:uploads:migrate", *args) run_rake_task("gitlab:uploads:migrate", *args)
end end
it 'enqueue jobs in batch' do shared_examples 'enqueue jobs in batch' do |batch:|
expect(ObjectStorage::MigrateUploadsWorker).to receive(:enqueue!).exactly(4).times it do
expect(ObjectStorage::MigrateUploadsWorker)
.to receive(:enqueue!).exactly(batch).times
run run
end 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 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