Commit ff3d6709 authored by Stan Hu's avatar Stan Hu

Merge branch '4871-gcp-geo-nodes-cannot-move-original-repository' into 'master'

Resolve "Investigate why GCP Geo nodes cannot move original repository out of the way"

Closes #4871

See merge request gitlab-org/gitlab-ee!4529
parents 204a77d1 8830ce30
---
title: "[Geo] Fix redownload repository recovery when there is not local repo at all"
merge_request:
author:
type: fixed
......@@ -184,8 +184,7 @@ module Geo
# 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)
# Move the original repository out of the way
unless gitlab_shell.mv_repository(project.repository_storage_path, repository.disk_path, deleted_disk_path_temp)
if project.repository_exists? && !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'
end
......
......@@ -247,7 +247,7 @@ describe Geo::RepositorySyncService do
subject.execute
end
it 'successfully redownloads the file even if the retry time exceeds max value' do
it 'successfully redownloads the repository even if the retry time exceeds max value' do
timestamp = Time.now.utc
registry = create(
:geo_project_registry,
......@@ -265,6 +265,20 @@ describe Geo::RepositorySyncService do
registry.reload
expect(registry.repository_retry_at).to be_nil
end
context 'no repository' do
let(:project) { create(:project) }
it 'does not raise an error' do
create(
:geo_project_registry,
project: project,
force_to_redownload_repository: true
)
subject.execute
end
end
end
end
end
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