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
04afe188
Commit
04afe188
authored
Jan 29, 2020
by
Luke Duncalfe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for hashed repo rollback scenario
parent
d89fde84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
app/services/projects/transfer_service.rb
app/services/projects/transfer_service.rb
+2
-0
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+19
-2
No files found.
app/services/projects/transfer_service.rb
View file @
04afe188
...
...
@@ -132,6 +132,8 @@ module Projects
end
def
rollback_folder_move
return
if
project
.
hashed_storage?
(
:repository
)
move_repo_folder
(
@new_path
,
@old_path
)
move_repo_folder
(
"
#{
@new_path
}
.wiki"
,
"
#{
@old_path
}
.wiki"
)
end
...
...
spec/services/projects/transfer_service_spec.rb
View file @
04afe188
...
...
@@ -299,14 +299,14 @@ describe Projects::TransferService do
end
context
'when hashed storage in use'
do
let
(
:hashed_project
)
{
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
}
let!
(
:hashed_project
)
{
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
}
let!
(
:old_disk_path
)
{
hashed_project
.
repository
.
disk_path
}
before
do
group
.
add_owner
(
user
)
end
it
'does not move the disk path'
,
:aggregate_failures
do
old_disk_path
=
hashed_project
.
repository
.
disk_path
new_full_path
=
"
#{
group
.
full_path
}
/
#{
hashed_project
.
path
}
"
transfer_project
(
hashed_project
,
user
,
group
)
...
...
@@ -318,6 +318,23 @@ describe Projects::TransferService do
)
expect
(
hashed_project
.
disk_path
).
to
eq
(
old_disk_path
)
end
it
'does not move the disk path when the transfer fails'
,
:aggregate_failures
do
old_full_path
=
hashed_project
.
full_path
expect_next_instance_of
(
described_class
)
do
|
service
|
allow
(
service
).
to
receive
(
:execute_system_hooks
).
and_raise
(
'foo'
)
end
expect
{
transfer_project
(
hashed_project
,
user
,
group
)
}.
to
raise_error
(
'foo'
)
hashed_project
.
reload_repository!
expect
(
hashed_project
.
repository
).
to
have_attributes
(
disk_path:
old_disk_path
,
full_path:
old_full_path
)
expect
(
hashed_project
.
disk_path
).
to
eq
(
old_disk_path
)
end
end
describe
'refreshing project authorizations'
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