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
e6208143
Commit
e6208143
authored
Mar 09, 2020
by
James Fargher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unneeded RepositoryAlreadyMoved exception
ReplicateRepository already handles this case
parent
36e0dc04
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2 additions
and
17 deletions
+2
-17
app/services/projects/update_repository_storage_service.rb
app/services/projects/update_repository_storage_service.rb
+0
-7
app/workers/project_update_repository_storage_worker.rb
app/workers/project_update_repository_storage_worker.rb
+0
-2
spec/services/projects/update_repository_storage_service_spec.rb
...rvices/projects/update_repository_storage_service_spec.rb
+1
-1
spec/support/shared_examples/services/projects/update_repository_storage_service_shared_examples.rb
...ects/update_repository_storage_service_shared_examples.rb
+1
-1
spec/workers/project_update_repository_storage_worker_spec.rb
.../workers/project_update_repository_storage_worker_spec.rb
+0
-6
No files found.
app/services/projects/update_repository_storage_service.rb
View file @
e6208143
...
@@ -5,19 +5,12 @@ module Projects
...
@@ -5,19 +5,12 @@ module Projects
include
Gitlab
::
ShellAdapter
include
Gitlab
::
ShellAdapter
Error
=
Class
.
new
(
StandardError
)
Error
=
Class
.
new
(
StandardError
)
RepositoryAlreadyMoved
=
Class
.
new
(
StandardError
)
def
initialize
(
project
)
def
initialize
(
project
)
@project
=
project
@project
=
project
end
end
def
execute
(
new_repository_storage_key
)
def
execute
(
new_repository_storage_key
)
# Raising an exception is a little heavy handed but this behavior (doing
# nothing if the repo is already on the right storage) prevents data
# loss, so it is valuable for us to be able to observe it via the
# exception.
raise
RepositoryAlreadyMoved
if
project
.
repository_storage
==
new_repository_storage_key
mirror_repositories
(
new_repository_storage_key
)
mirror_repositories
(
new_repository_storage_key
)
mark_old_paths_for_archive
mark_old_paths_for_archive
...
...
app/workers/project_update_repository_storage_worker.rb
View file @
e6208143
...
@@ -9,7 +9,5 @@ class ProjectUpdateRepositoryStorageWorker # rubocop:disable Scalability/Idempot
...
@@ -9,7 +9,5 @@ class ProjectUpdateRepositoryStorageWorker # rubocop:disable Scalability/Idempot
project
=
Project
.
find
(
project_id
)
project
=
Project
.
find
(
project_id
)
::
Projects
::
UpdateRepositoryStorageService
.
new
(
project
).
execute
(
new_repository_storage_key
)
::
Projects
::
UpdateRepositoryStorageService
.
new
(
project
).
execute
(
new_repository_storage_key
)
rescue
::
Projects
::
UpdateRepositoryStorageService
::
RepositoryAlreadyMoved
Rails
.
logger
.
info
"
#{
self
.
class
}
: repository already moved:
#{
project
}
"
# rubocop:disable Gitlab/RailsLogger
end
end
end
end
spec/services/projects/update_repository_storage_service_spec.rb
View file @
e6208143
...
@@ -51,7 +51,7 @@ describe Projects::UpdateRepositoryStorageService do
...
@@ -51,7 +51,7 @@ describe Projects::UpdateRepositoryStorageService do
it
'bails out and does nothing'
do
it
'bails out and does nothing'
do
expect
do
expect
do
subject
.
execute
(
project
.
repository_storage
)
subject
.
execute
(
project
.
repository_storage
)
end
.
to
raise_error
(
described_class
::
RepositoryAlreadyMoved
)
end
.
to
raise_error
(
ArgumentError
,
/repository and source have the same storage/
)
end
end
end
end
...
...
spec/support/shared_examples/services/projects/update_repository_storage_service_shared_examples.rb
View file @
e6208143
...
@@ -85,7 +85,7 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
...
@@ -85,7 +85,7 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
it
'bails out and does nothing'
do
it
'bails out and does nothing'
do
expect
do
expect
do
subject
.
execute
(
project
.
repository_storage
)
subject
.
execute
(
project
.
repository_storage
)
end
.
to
raise_error
(
described_class
::
RepositoryAlreadyMoved
)
end
.
to
raise_error
(
ArgumentError
,
/repository and source have the same storage/
)
end
end
end
end
...
...
spec/workers/project_update_repository_storage_worker_spec.rb
View file @
e6208143
...
@@ -14,11 +14,5 @@ describe ProjectUpdateRepositoryStorageWorker do
...
@@ -14,11 +14,5 @@ describe ProjectUpdateRepositoryStorageWorker do
subject
.
perform
(
project
.
id
,
'new_storage'
)
subject
.
perform
(
project
.
id
,
'new_storage'
)
end
end
it
'catches and logs RepositoryAlreadyMoved'
do
expect
(
Rails
.
logger
).
to
receive
(
:info
).
with
(
/repository already moved/
)
expect
{
subject
.
perform
(
project
.
id
,
project
.
repository_storage
)
}.
not_to
raise_error
end
end
end
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