Fix last batch size equals max batch size error

This commit is contained in:
Michael Kozono 2018-02-08 10:08:55 -08:00
parent bbfec704f7
commit f917fc5d76
2 changed files with 25 additions and 1 deletions

View file

@ -92,7 +92,7 @@ module Gitlab
end
end
yield(paths)
yield(paths) if paths.any?
end
def build_find_command(search_dir)

View file

@ -133,6 +133,18 @@ describe Gitlab::BackgroundMigration::PrepareUntrackedUploads, :sidekiq do
context 'when there are files in /uploads/tmp' do
it_behaves_like 'does not add files in /uploads/tmp'
end
context 'when the last batch size exactly matches the max batch size' do
it 'does not raise error' do
stub_const("#{described_class}::FIND_BATCH_SIZE", 5)
expect do
described_class.new.perform
end.not_to raise_error
expect(untracked_files_for_uploads.count).to eq(5)
end
end
end
end
@ -205,6 +217,18 @@ describe Gitlab::BackgroundMigration::PrepareUntrackedUploads, :sidekiq do
context 'when there are files in /uploads/tmp' do
it_behaves_like 'does not add files in /uploads/tmp'
end
context 'when the last batch size exactly matches the max batch size' do
it 'does not raise error' do
stub_const("#{described_class}::FIND_BATCH_SIZE", 5)
expect do
described_class.new.perform
end.not_to raise_error
expect(untracked_files_for_uploads.count).to eq(5)
end
end
end
end