debian-mirror-gitlab/spec/tasks/gitlab/uploads/check_rake_spec.rb

31 lines
1,008 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
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
2018-03-27 19:54:05 +05:30
Rake.application.rake_require('tasks/gitlab/uploads/check')
stub_env('VERBOSE' => 'true')
2018-03-17 18:26:18 +05:30
end
2018-03-27 19:54:05 +05:30
it 'outputs the integrity check for each batch' do
expect { run_rake_task('gitlab:uploads:check') }.to output(/Failures: 0/).to_stdout
2018-03-17 18:26:18 +05:30
end
it 'errors out about missing files on the file system' do
2018-03-27 19:54:05 +05:30
missing_upload = create(:upload)
2018-03-17 18:26:18 +05:30
2018-03-27 19:54:05 +05:30
expect { run_rake_task('gitlab:uploads:check') }.to output(/No such file.*#{Regexp.quote(missing_upload.absolute_path)}/).to_stdout
2018-03-17 18:26:18 +05:30
end
it 'errors out about invalid checksum' do
upload.update_column(:checksum, '01a3156db2cf4f67ec823680b40b7302f89ab39179124ad219f94919b8a1769e')
2018-03-27 19:54:05 +05:30
expect { run_rake_task('gitlab:uploads:check') }.to output(/Checksum mismatch/).to_stdout
2018-03-17 18:26:18 +05:30
end
end
end