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
94dc43f3
Commit
94dc43f3
authored
Mar 02, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up backup/restore temporary directory
parent
405c4cae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
spec/lib/backup/repository_spec.rb
spec/lib/backup/repository_spec.rb
+19
-2
No files found.
spec/lib/backup/repository_spec.rb
View file @
94dc43f3
...
@@ -28,6 +28,23 @@ describe Backup::Repository do
...
@@ -28,6 +28,23 @@ describe Backup::Repository do
end
end
describe
'#restore'
do
describe
'#restore'
do
subject
{
described_class
.
new
}
let
(
:timestamp
)
{
Time
.
utc
(
2017
,
3
,
22
)
}
let
(
:temp_dirs
)
do
Gitlab
.
config
.
repositories
.
storages
.
map
do
|
name
,
storage
|
File
.
join
(
storage
[
'path'
],
'..'
,
'repositories.old.'
+
timestamp
.
to_i
.
to_s
)
end
end
around
do
|
example
|
Timecop
.
freeze
(
timestamp
)
{
example
.
run
}
end
after
do
temp_dirs
.
each
{
|
path
|
FileUtils
.
rm_rf
(
path
)
}
end
describe
'command failure'
do
describe
'command failure'
do
before
do
before
do
allow
(
Gitlab
::
Popen
).
to
receive
(
:popen
).
and_return
([
'error'
,
1
])
allow
(
Gitlab
::
Popen
).
to
receive
(
:popen
).
and_return
([
'error'
,
1
])
...
@@ -35,7 +52,7 @@ describe Backup::Repository do
...
@@ -35,7 +52,7 @@ describe Backup::Repository do
context
'hashed storage'
do
context
'hashed storage'
do
it
'shows the appropriate error'
do
it
'shows the appropriate error'
do
described_class
.
new
.
restore
subject
.
restore
expect
(
progress
).
to
have_received
(
:puts
).
with
(
"Ignoring error on
#{
project
.
full_path
}
(
#{
project
.
disk_path
}
) - error"
)
expect
(
progress
).
to
have_received
(
:puts
).
with
(
"Ignoring error on
#{
project
.
full_path
}
(
#{
project
.
disk_path
}
) - error"
)
end
end
...
@@ -45,7 +62,7 @@ describe Backup::Repository do
...
@@ -45,7 +62,7 @@ describe Backup::Repository do
let!
(
:project
)
{
create
(
:project
,
:legacy_storage
)
}
let!
(
:project
)
{
create
(
:project
,
:legacy_storage
)
}
it
'shows the appropriate error'
do
it
'shows the appropriate error'
do
described_class
.
new
.
restore
subject
.
restore
expect
(
progress
).
to
have_received
(
:puts
).
with
(
"Ignoring error on
#{
project
.
full_path
}
- error"
)
expect
(
progress
).
to
have_received
(
:puts
).
with
(
"Ignoring error on
#{
project
.
full_path
}
- 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