diff options
author | Nick Thomas <nick@gitlab.com> | 2018-02-27 19:15:25 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-03-02 14:16:17 +0000 |
commit | 6f945f20b4c3683bc862ebc476bad9331d72784e (patch) | |
tree | 9504637169d3a410e03e9e75f1d72ee6a323187f /spec/tasks/gitlab/uploads | |
parent | 40c61acb6a9ba84928cebcbce8b57630bd439615 (diff) | |
download | gitlab-ce-ee-4862-verify-file-checksums.tar.gz |
Foreground verification of uploads and LFS objectsee-4862-verify-file-checksums
Diffstat (limited to 'spec/tasks/gitlab/uploads')
-rw-r--r-- | spec/tasks/gitlab/uploads/check_rake_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/uploads/check_rake_spec.rb b/spec/tasks/gitlab/uploads/check_rake_spec.rb new file mode 100644 index 00000000000..5d597c66133 --- /dev/null +++ b/spec/tasks/gitlab/uploads/check_rake_spec.rb @@ -0,0 +1,28 @@ +require 'rake_helper' + +describe 'gitlab:uploads rake tasks' do + describe 'check' do + let!(:upload) { create(:upload, path: Rails.root.join('spec/fixtures/banana_sample.gif')) } + + before do + Rake.application.rake_require('tasks/gitlab/uploads/check') + stub_env('VERBOSE' => 'true') + end + + it 'outputs the integrity check for each batch' do + expect { run_rake_task('gitlab:uploads:check') }.to output(/Failures: 0/).to_stdout + end + + it 'errors out about missing files on the file system' do + missing_upload = create(:upload) + + expect { run_rake_task('gitlab:uploads:check') }.to output(/No such file.*#{Regexp.quote(missing_upload.absolute_path)}/).to_stdout + end + + it 'errors out about invalid checksum' do + upload.update_column(:checksum, '01a3156db2cf4f67ec823680b40b7302f89ab39179124ad219f94919b8a1769e') + + expect { run_rake_task('gitlab:uploads:check') }.to output(/Checksum mismatch/).to_stdout + end + end +end |