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
Tatuya Kamada
gitlab-ce
Commits
2219743d
Commit
2219743d
authored
Nov 18, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add lfs to backup specs.
parent
3cc2b48a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
spec/tasks/gitlab/backup_rake_spec.rb
spec/tasks/gitlab/backup_rake_spec.rb
+9
-5
No files found.
spec/tasks/gitlab/backup_rake_spec.rb
View file @
2219743d
...
@@ -16,7 +16,7 @@ describe 'gitlab:app namespace rake task' do
...
@@ -16,7 +16,7 @@ describe 'gitlab:app namespace rake task' do
end
end
def
reenable_backup_sub_tasks
def
reenable_backup_sub_tasks
%w{db repo uploads builds artifacts}
.
each
do
|
subtask
|
%w{db repo uploads builds artifacts
lfs
}
.
each
do
|
subtask
|
Rake
::
Task
[
"gitlab:backup:
#{
subtask
}
:create"
].
reenable
Rake
::
Task
[
"gitlab:backup:
#{
subtask
}
:create"
].
reenable
end
end
end
end
...
@@ -49,7 +49,7 @@ describe 'gitlab:app namespace rake task' do
...
@@ -49,7 +49,7 @@ describe 'gitlab:app namespace rake task' do
to
raise_error
(
SystemExit
)
to
raise_error
(
SystemExit
)
end
end
it
'should invoke restoration on mach'
do
it
'should invoke restoration on ma
t
ch'
do
allow
(
YAML
).
to
receive
(
:load_file
).
allow
(
YAML
).
to
receive
(
:load_file
).
and_return
({
gitlab_version:
gitlab_version
})
and_return
({
gitlab_version:
gitlab_version
})
expect
(
Rake
::
Task
[
"gitlab:backup:db:restore"
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
"gitlab:backup:db:restore"
]).
to
receive
(
:invoke
)
...
@@ -57,6 +57,7 @@ describe 'gitlab:app namespace rake task' do
...
@@ -57,6 +57,7 @@ describe 'gitlab:app namespace rake task' do
expect
(
Rake
::
Task
[
"gitlab:backup:builds:restore"
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
"gitlab:backup:builds:restore"
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
"gitlab:backup:uploads:restore"
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
"gitlab:backup:uploads:restore"
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
"gitlab:backup:artifacts:restore"
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
"gitlab:backup:artifacts:restore"
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
"gitlab:backup:lfs:restore"
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
"gitlab:shell:setup"
]).
to
receive
(
:invoke
)
expect
(
Rake
::
Task
[
"gitlab:shell:setup"
]).
to
receive
(
:invoke
)
expect
{
run_rake_task
(
'gitlab:backup:restore'
)
}.
not_to
raise_error
expect
{
run_rake_task
(
'gitlab:backup:restore'
)
}.
not_to
raise_error
end
end
...
@@ -114,7 +115,7 @@ describe 'gitlab:app namespace rake task' do
...
@@ -114,7 +115,7 @@ describe 'gitlab:app namespace rake task' do
it
'should set correct permissions on the tar contents'
do
it
'should set correct permissions on the tar contents'
do
tar_contents
,
exit_status
=
Gitlab
::
Popen
.
popen
(
tar_contents
,
exit_status
=
Gitlab
::
Popen
.
popen
(
%W{tar -tvf
#{
@backup_tar
}
db uploads.tar.gz repositories builds.tar.gz artifacts.tar.gz}
%W{tar -tvf
#{
@backup_tar
}
db uploads.tar.gz repositories builds.tar.gz artifacts.tar.gz
lfs.tar.gz
}
)
)
expect
(
exit_status
).
to
eq
(
0
)
expect
(
exit_status
).
to
eq
(
0
)
expect
(
tar_contents
).
to
match
(
'db/'
)
expect
(
tar_contents
).
to
match
(
'db/'
)
...
@@ -122,12 +123,13 @@ describe 'gitlab:app namespace rake task' do
...
@@ -122,12 +123,13 @@ describe 'gitlab:app namespace rake task' do
expect
(
tar_contents
).
to
match
(
'repositories/'
)
expect
(
tar_contents
).
to
match
(
'repositories/'
)
expect
(
tar_contents
).
to
match
(
'builds.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'builds.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'artifacts.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'artifacts.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'lfs.tar.gz'
)
expect
(
tar_contents
).
not_to
match
(
/^.{4,9}[rwx].* (database.sql.gz|uploads.tar.gz|repositories|builds.tar.gz|artifacts.tar.gz)\/$/
)
expect
(
tar_contents
).
not_to
match
(
/^.{4,9}[rwx].* (database.sql.gz|uploads.tar.gz|repositories|builds.tar.gz|artifacts.tar.gz)\/$/
)
end
end
it
'should delete temp directories'
do
it
'should delete temp directories'
do
temp_dirs
=
Dir
.
glob
(
temp_dirs
=
Dir
.
glob
(
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
'{db,repositories,uploads,builds,artifacts}'
)
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
'{db,repositories,uploads,builds,artifacts
,lfs
}'
)
)
)
expect
(
temp_dirs
).
to
be_empty
expect
(
temp_dirs
).
to
be_empty
...
@@ -163,13 +165,14 @@ describe 'gitlab:app namespace rake task' do
...
@@ -163,13 +165,14 @@ describe 'gitlab:app namespace rake task' do
it
"does not contain skipped item"
do
it
"does not contain skipped item"
do
tar_contents
,
_exit_status
=
Gitlab
::
Popen
.
popen
(
tar_contents
,
_exit_status
=
Gitlab
::
Popen
.
popen
(
%W{tar -tvf
#{
@backup_tar
}
db uploads.tar.gz repositories builds.tar.gz artifacts.tar.gz}
%W{tar -tvf
#{
@backup_tar
}
db uploads.tar.gz repositories builds.tar.gz artifacts.tar.gz
lfs.tar.gz
}
)
)
expect
(
tar_contents
).
to
match
(
'db/'
)
expect
(
tar_contents
).
to
match
(
'db/'
)
expect
(
tar_contents
).
to
match
(
'uploads.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'uploads.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'builds.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'builds.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'artifacts.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'artifacts.tar.gz'
)
expect
(
tar_contents
).
to
match
(
'lfs.tar.gz'
)
expect
(
tar_contents
).
not_to
match
(
'repositories/'
)
expect
(
tar_contents
).
not_to
match
(
'repositories/'
)
end
end
...
@@ -183,6 +186,7 @@ describe 'gitlab:app namespace rake task' do
...
@@ -183,6 +186,7 @@ describe 'gitlab:app namespace rake task' do
expect
(
Rake
::
Task
[
"gitlab:backup:uploads:restore"
]).
not_to
receive
:invoke
expect
(
Rake
::
Task
[
"gitlab:backup:uploads:restore"
]).
not_to
receive
:invoke
expect
(
Rake
::
Task
[
"gitlab:backup:builds:restore"
]).
to
receive
:invoke
expect
(
Rake
::
Task
[
"gitlab:backup:builds:restore"
]).
to
receive
:invoke
expect
(
Rake
::
Task
[
"gitlab:backup:artifacts:restore"
]).
to
receive
:invoke
expect
(
Rake
::
Task
[
"gitlab:backup:artifacts:restore"
]).
to
receive
:invoke
expect
(
Rake
::
Task
[
"gitlab:backup:lfs:restore"
]).
to
receive
:invoke
expect
(
Rake
::
Task
[
"gitlab:shell:setup"
]).
to
receive
:invoke
expect
(
Rake
::
Task
[
"gitlab:shell:setup"
]).
to
receive
:invoke
expect
{
run_rake_task
(
'gitlab:backup:restore'
)
}.
not_to
raise_error
expect
{
run_rake_task
(
'gitlab:backup:restore'
)
}.
not_to
raise_error
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