2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
require 'rake_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe 'gitlab:lfs rake tasks' do
|
2018-03-27 19:54:05 +05:30
|
|
|
describe 'check' do
|
|
|
|
let!(:lfs_object) { create(:lfs_object, :with_file, :correct_oid) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
Rake.application.rake_require('tasks/gitlab/lfs/check')
|
|
|
|
stub_env('VERBOSE' => 'true')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'outputs the integrity check for each batch' do
|
|
|
|
expect { run_rake_task('gitlab:lfs:check') }.to output(/Failures: 0/).to_stdout
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'errors out about missing files on the file system' do
|
|
|
|
FileUtils.rm_f(lfs_object.file.path)
|
|
|
|
|
|
|
|
expect { run_rake_task('gitlab:lfs:check') }.to output(/No such file.*#{Regexp.quote(lfs_object.file.path)}/).to_stdout
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'errors out about invalid checksum' do
|
|
|
|
File.truncate(lfs_object.file.path, 0)
|
|
|
|
|
|
|
|
expect { run_rake_task('gitlab:lfs:check') }.to output(/Checksum mismatch/).to_stdout
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|