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
1b4e1fa8
Commit
1b4e1fa8
authored
Mar 06, 2020
by
James Fargher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ReplicateRepository in favor of FetchInternalRemote
This was the last usage of FetchInternalRemote
parent
8cc82033
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
15 deletions
+24
-15
app/services/projects/update_repository_storage_service.rb
app/services/projects/update_repository_storage_service.rb
+1
-1
changelogs/unreleased/use_replicate_repo_for_repo_move.yml
changelogs/unreleased/use_replicate_repo_for_repo_move.yml
+5
-0
spec/services/projects/fork_service_spec.rb
spec/services/projects/fork_service_spec.rb
+1
-1
spec/services/projects/update_repository_storage_service_spec.rb
...rvices/projects/update_repository_storage_service_spec.rb
+4
-4
spec/support/shared_examples/services/projects/update_repository_storage_service_shared_examples.rb
...ects/update_repository_storage_service_shared_examples.rb
+13
-9
No files found.
app/services/projects/update_repository_storage_service.rb
View file @
1b4e1fa8
...
...
@@ -65,7 +65,7 @@ module Projects
raw_repository
.
gl_repository
,
full_path
)
unless
new_repository
.
fetch_repository_as_mirror
(
raw_repository
)
unless
new_repository
.
replicate
(
raw_repository
)
raise
Error
,
s_
(
'UpdateRepositoryStorage|Failed to fetch %{type} repository as mirror'
)
%
{
type:
type
.
name
}
end
...
...
changelogs/unreleased/use_replicate_repo_for_repo_move.yml
0 → 100644
View file @
1b4e1fa8
---
title
:
Use ReplicateRepository when moving repo storage
merge_request
:
26550
author
:
type
:
changed
spec/services/projects/fork_service_spec.rb
View file @
1b4e1fa8
...
...
@@ -312,7 +312,7 @@ describe Projects::ForkService do
# Stub everything required to move a project to a Gitaly shard that does not exist
stub_storage_settings
(
'test_second_storage'
=>
{
'path'
=>
'tmp/tests/second_storage'
})
allow_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:
fetch_repository_as_mirror
).
and_return
(
true
)
allow_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:
replicate
).
and_return
(
true
)
allow_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:checksum
).
and_return
(
::
Gitlab
::
Git
::
BLANK_SHA
)
Projects
::
UpdateRepositoryStorageService
.
new
(
project
).
execute
(
'test_second_storage'
)
...
...
spec/services/projects/update_repository_storage_service_spec.rb
View file @
1b4e1fa8
...
...
@@ -32,7 +32,7 @@ describe Projects::UpdateRepositoryStorageService do
project
.
repository
.
path_to_repo
end
expect
(
project_repository_double
).
to
receive
(
:
fetch_repository_as_mirror
)
expect
(
project_repository_double
).
to
receive
(
:
replicate
)
.
with
(
project
.
repository
.
raw
).
and_return
(
true
)
expect
(
project_repository_double
).
to
receive
(
:checksum
)
.
and_return
(
checksum
)
...
...
@@ -57,7 +57,7 @@ describe Projects::UpdateRepositoryStorageService do
context
'when the move fails'
do
it
'unmarks the repository as read-only without updating the repository storage'
do
expect
(
project_repository_double
).
to
receive
(
:
fetch_repository_as_mirror
)
expect
(
project_repository_double
).
to
receive
(
:
replicate
)
.
with
(
project
.
repository
.
raw
).
and_return
(
false
)
expect
(
GitlabShellWorker
).
not_to
receive
(
:perform_async
)
...
...
@@ -71,7 +71,7 @@ describe Projects::UpdateRepositoryStorageService do
context
'when the checksum does not match'
do
it
'unmarks the repository as read-only without updating the repository storage'
do
expect
(
project_repository_double
).
to
receive
(
:
fetch_repository_as_mirror
)
expect
(
project_repository_double
).
to
receive
(
:
replicate
)
.
with
(
project
.
repository
.
raw
).
and_return
(
true
)
expect
(
project_repository_double
).
to
receive
(
:checksum
)
.
and_return
(
'not matching checksum'
)
...
...
@@ -89,7 +89,7 @@ describe Projects::UpdateRepositoryStorageService do
let!
(
:pool
)
{
create
(
:pool_repository
,
:ready
,
source_project:
project
)
}
it
'leaves the pool'
do
expect
(
project_repository_double
).
to
receive
(
:
fetch_repository_as_mirror
)
expect
(
project_repository_double
).
to
receive
(
:
replicate
)
.
with
(
project
.
repository
.
raw
).
and_return
(
true
)
expect
(
project_repository_double
).
to
receive
(
:checksum
)
.
and_return
(
checksum
)
...
...
spec/support/shared_examples/services/projects/update_repository_storage_service_shared_examples.rb
View file @
1b4e1fa8
...
...
@@ -22,14 +22,15 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
context
'when the move succeeds'
,
:clean_gitlab_redis_shared_state
do
before
do
allow
(
project_repository_double
).
to
receive
(
:
fetch_repository_as_mirror
)
allow
(
project_repository_double
).
to
receive
(
:
replicate
)
.
with
(
project
.
repository
.
raw
)
.
and_return
(
true
)
allow
(
project_repository_double
).
to
receive
(
:checksum
)
.
and_return
(
project_repository_checksum
)
allow
(
repository_double
).
to
receive
(
:fetch_repository_as_mirror
)
.
with
(
repository
.
raw
).
and_return
(
true
)
allow
(
repository_double
).
to
receive
(
:replicate
)
.
with
(
repository
.
raw
)
.
and_return
(
true
)
allow
(
repository_double
).
to
receive
(
:checksum
)
.
and_return
(
repository_checksum
)
end
...
...
@@ -90,12 +91,15 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
context
"when the move of the
#{
repository_type
}
repository fails"
do
it
'unmarks the repository as read-only without updating the repository storage'
do
allow
(
project_repository_double
).
to
receive
(
:fetch_repository_as_mirror
)
.
with
(
project
.
repository
.
raw
).
and_return
(
true
)
allow
(
project_repository_double
).
to
receive
(
:replicate
)
.
with
(
project
.
repository
.
raw
)
.
and_return
(
true
)
allow
(
project_repository_double
).
to
receive
(
:checksum
)
.
and_return
(
project_repository_checksum
)
allow
(
repository_double
).
to
receive
(
:fetch_repository_as_mirror
)
.
with
(
repository
.
raw
).
and_return
(
false
)
allow
(
repository_double
).
to
receive
(
:replicate
)
.
with
(
repository
.
raw
)
.
and_return
(
false
)
expect
(
GitlabShellWorker
).
not_to
receive
(
:perform_async
)
...
...
@@ -109,12 +113,12 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
context
"when the checksum of the
#{
repository_type
}
repository does not match"
do
it
'unmarks the repository as read-only without updating the repository storage'
do
allow
(
project_repository_double
).
to
receive
(
:
fetch_repository_as_mirror
)
allow
(
project_repository_double
).
to
receive
(
:
replicate
)
.
with
(
project
.
repository
.
raw
).
and_return
(
true
)
allow
(
project_repository_double
).
to
receive
(
:checksum
)
.
and_return
(
project_repository_checksum
)
allow
(
repository_double
).
to
receive
(
:
fetch_repository_as_mirror
)
allow
(
repository_double
).
to
receive
(
:
replicate
)
.
with
(
repository
.
raw
).
and_return
(
true
)
allow
(
repository_double
).
to
receive
(
:checksum
)
.
and_return
(
'not matching checksum'
)
...
...
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