diff options
author | Michael Kozono <mkozono@gmail.com> | 2018-02-08 10:08:55 -0800 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2018-02-12 10:44:15 -0800 |
commit | f917fc5d76d39fb17fda2678d5270407595f0128 (patch) | |
tree | e3a0e62c02e1ef110caafda3753b643e8e26545b /spec/lib/gitlab | |
parent | bbfec704f7ed964807f2c14cac51ef8d0f9ff417 (diff) | |
download | gitlab-ce-f917fc5d76d39fb17fda2678d5270407595f0128.tar.gz |
Fix last batch size equals max batch size error
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb b/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb index 48204114ae8..8189e74646a 100644 --- a/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb +++ b/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb @@ -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 |