Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
de36a8e2
Commit
de36a8e2
authored
Jan 04, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor spec, add docs
parent
6ee122c0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
10 deletions
+11
-10
doc/administration/raketasks/check.md
doc/administration/raketasks/check.md
+2
-2
lib/tasks/gitlab/git.rake
lib/tasks/gitlab/git.rake
+1
-0
spec/tasks/gitlab/git_rake_spec.rb
spec/tasks/gitlab/git_rake_spec.rb
+8
-8
No files found.
doc/administration/raketasks/check.md
View file @
de36a8e2
...
@@ -34,13 +34,13 @@ This task loops through all repositories on the GitLab server and runs the
...
@@ -34,13 +34,13 @@ This task loops through all repositories on the GitLab server and runs the
**Omnibus Installation**
**Omnibus Installation**
```
```
sudo gitlab-rake gitlab:
repo:che
ck
sudo gitlab-rake gitlab:
git:fs
ck
```
```
**Source Installation**
**Source Installation**
```
bash
```
bash
sudo
-u
git
-H
bundle
exec
rake gitlab:
repo:che
ck
RAILS_ENV
=
production
sudo
-u
git
-H
bundle
exec
rake gitlab:
git:fs
ck
RAILS_ENV
=
production
```
```
### Check repositories for a specific user
### Check repositories for a specific user
...
...
lib/tasks/gitlab/git.rake
View file @
de36a8e2
...
@@ -36,6 +36,7 @@ namespace :gitlab do
...
@@ -36,6 +36,7 @@ namespace :gitlab do
check_config_lock
(
repo
)
check_config_lock
(
repo
)
check_ref_locks
(
repo
)
check_ref_locks
(
repo
)
end
end
if
failures
.
empty?
if
failures
.
empty?
puts
"Done"
.
color
(
:green
)
puts
"Done"
.
color
(
:green
)
else
else
...
...
spec/tasks/gitlab/git_rake_spec.rb
View file @
de36a8e2
require
'rake_helper'
require
'rake_helper'
describe
'gitlab:git rake tasks'
do
describe
'gitlab:git rake tasks'
do
...
@@ -8,8 +6,10 @@ 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'
)
}
}
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
(
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
stub_warn_user_is_not_gitlab
end
end
...
@@ -18,19 +18,19 @@ describe 'gitlab:git rake tasks' do
...
@@ -18,19 +18,19 @@ describe 'gitlab:git rake tasks' do
end
end
describe
'fsck'
do
describe
'fsck'
do
it
'outputs the
right git command
'
do
it
'outputs the
integrity check for a repo
'
do
expect
{
run_rake_task
(
'gitlab:git:fsck'
)
}.
to
output
(
/Performed Checking integrity/
).
to_stdout
expect
{
run_rake_task
(
'gitlab:git:fsck'
)
}.
to
output
(
/Performed Checking integrity
at .*@hashed\/1\/2\/test.git
/
).
to_stdout
end
end
it
'errors out about config.lock issues'
do
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
expect
{
run_rake_task
(
'gitlab:git:fsck'
)
}.
to
output
(
/file exists\? ... yes/
).
to_stdout
end
end
it
'errors out about ref lock issues'
do
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
.
mkdir_p
(
Settings
.
absolute
(
'tmp/tests/default_storage/@
hashed
/1/2/test.git/refs/heads'
))
FileUtils
.
touch
(
Settings
.
absolute
(
'tmp/tests/default_storage/@
repo
/1/2/test.git/refs/heads/blah.lock'
))
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
expect
{
run_rake_task
(
'gitlab:git:fsck'
)
}.
to
output
(
/Ref lock files exist:/
).
to_stdout
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment