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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0194dd41
Commit
0194dd41
authored
Jul 07, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for custom backup archive file permissions
parent
bb50b7fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
spec/tasks/gitlab/backup_rake_spec.rb
spec/tasks/gitlab/backup_rake_spec.rb
+27
-4
No files found.
spec/tasks/gitlab/backup_rake_spec.rb
View file @
0194dd41
...
...
@@ -60,7 +60,7 @@ describe 'gitlab:app namespace rake task' do
Dir
.
glob
(
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
'*_gitlab_backup.tar'
))
end
before
:all
do
def
create_backup
# Record the existing backup tars so we don't touch them
existing_tars
=
tars_glob
...
...
@@ -73,13 +73,36 @@ describe 'gitlab:app namespace rake task' do
@backup_tar
=
(
tars_glob
-
existing_tars
).
first
end
before
:all
do
create_backup
end
after
:all
do
FileUtils
.
rm
(
@backup_tar
)
end
it
'should set correct permissions on the tar file'
do
expect
(
File
.
exist?
(
@backup_tar
)).
to
be_truthy
expect
(
File
::
Stat
.
new
(
@backup_tar
).
mode
.
to_s
(
8
)).
to
eq
(
'100600'
)
context
'archive file permissions'
do
it
'should set correct permissions on the tar file'
do
expect
(
File
.
exist?
(
@backup_tar
)).
to
be_truthy
expect
(
File
::
Stat
.
new
(
@backup_tar
).
mode
.
to_s
(
8
)).
to
eq
(
'100600'
)
end
context
'with custom archive_permissions'
do
before
do
allow
(
Gitlab
.
config
.
backup
).
to
receive
(
:archive_permissions
).
and_return
(
0651
)
# We created a backup in a before(:all) so it got the default permissions.
# We now need to do some work to create a _new_ backup file using our stub.
FileUtils
.
rm
(
@backup_tar
)
Rake
::
Task
[
"gitlab:backup:db:create"
].
reenable
Rake
::
Task
[
"gitlab:backup:repo:create"
].
reenable
Rake
::
Task
[
"gitlab:backup:uploads:create"
].
reenable
create_backup
end
it
'uses the custom permissions'
do
expect
(
File
::
Stat
.
new
(
@backup_tar
).
mode
.
to_s
(
8
)).
to
eq
(
'100651'
)
end
end
end
it
'should set correct permissions on the tar contents'
do
...
...
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