Commit 042440fc authored by Valery Sizov's avatar Valery Sizov

[Geo] Fix redownload repository recovery when there is not local repo at all

parent faba2d7c
...@@ -184,8 +184,7 @@ module Geo ...@@ -184,8 +184,7 @@ module Geo
# Remove the deleted path in case it exists, but it may not be there # Remove the deleted path in case it exists, but it may not be there
gitlab_shell.remove_repository(project.repository_storage_path, deleted_disk_path_temp) gitlab_shell.remove_repository(project.repository_storage_path, deleted_disk_path_temp)
# Move the original repository out of the way if project.repository_exists? && !gitlab_shell.mv_repository(project.repository_storage_path, repository.disk_path, deleted_disk_path_temp)
unless gitlab_shell.mv_repository(project.repository_storage_path, repository.disk_path, deleted_disk_path_temp)
raise Gitlab::Shell::Error, 'Can not move original repository out of the way' raise Gitlab::Shell::Error, 'Can not move original repository out of the way'
end end
......
...@@ -247,7 +247,21 @@ describe Geo::RepositorySyncService do ...@@ -247,7 +247,21 @@ describe Geo::RepositorySyncService do
subject.execute subject.execute
end end
it 'successfully redownloads the file even if the retry time exceeds max value' do context 'no repository' do
let(:project) { create(:project) }
it 'does not raise an error' do
project_registry = create(
:geo_project_registry,
project: project,
force_to_redownload_repository: true
)
subject.execute
end
end
it 'successfully redownloads the repository even if the retry time exceeds max value' do
timestamp = Time.now.utc timestamp = Time.now.utc
registry = create( registry = create(
:geo_project_registry, :geo_project_registry,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment