Commit de36a8e2 authored by James Lopez's avatar James Lopez

refactor spec, add docs

parent 6ee122c0
......@@ -34,13 +34,13 @@ This task loops through all repositories on the GitLab server and runs the
**Omnibus Installation**
```
sudo gitlab-rake gitlab:repo:check
sudo gitlab-rake gitlab:git:fsck
```
**Source Installation**
```bash
sudo -u git -H bundle exec rake gitlab:repo:check RAILS_ENV=production
sudo -u git -H bundle exec rake gitlab:git:fsck RAILS_ENV=production
```
### Check repositories for a specific user
......
......@@ -36,6 +36,7 @@ namespace :gitlab do
check_config_lock(repo)
check_ref_locks(repo)
end
if failures.empty?
puts "Done".color(:green)
else
......
require 'rake_helper'
describe 'gitlab:git rake tasks' do
......@@ -8,8 +6,10 @@ describe 'gitlab:git rake tasks' do
storages = { 'default' => { 'path' => Settings.absolute('tmp/tests/default_storage') } }
FileUtils.mkdir_p(Settings.absolute('tmp/tests/default_storage/@repo/1/2/test.git'))
FileUtils.mkdir_p(Settings.absolute('tmp/tests/default_storage/@hashed/1/2/test.git'))
allow(Gitlab.config.repositories).to receive(:storages).and_return(storages)
allow_any_instance_of(String).to receive(:color) { |string, _color| string }
stub_warn_user_is_not_gitlab
end
......@@ -18,19 +18,19 @@ describe 'gitlab:git rake tasks' do
end
describe 'fsck' do
it 'outputs the right git command' do
expect { run_rake_task('gitlab:git:fsck') }.to output(/Performed Checking integrity/).to_stdout
it 'outputs the integrity check for a repo' do
expect { run_rake_task('gitlab:git:fsck') }.to output(/Performed Checking integrity at .*@hashed\/1\/2\/test.git/).to_stdout
end
it 'errors out about config.lock issues' do
FileUtils.touch(Settings.absolute('tmp/tests/default_storage/@repo/1/2/test.git/config.lock'))
FileUtils.touch(Settings.absolute('tmp/tests/default_storage/@hashed/1/2/test.git/config.lock'))
expect { run_rake_task('gitlab:git:fsck') }.to output(/file exists\? ... yes/).to_stdout
end
it 'errors out about ref lock issues' do
FileUtils.mkdir_p(Settings.absolute('tmp/tests/default_storage/@repo/1/2/test.git/refs/heads'))
FileUtils.touch(Settings.absolute('tmp/tests/default_storage/@repo/1/2/test.git/refs/heads/blah.lock'))
FileUtils.mkdir_p(Settings.absolute('tmp/tests/default_storage/@hashed/1/2/test.git/refs/heads'))
FileUtils.touch(Settings.absolute('tmp/tests/default_storage/@hashed/1/2/test.git/refs/heads/blah.lock'))
expect { run_rake_task('gitlab:git:fsck') }.to output(/Ref lock files exist:/).to_stdout
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment