Commit 887af081 authored by Stan Hu's avatar Stan Hu

Merge branch...

Merge branch '5409-geo-recovery-from-geo-temporary-directory-doesn-t-work-if-the-namespace-directory-doesn-t-exist' into 'master'

Resolve "Geo: Recovery from @geo-temporary directory doesn't work if the namespace directory doesn't exist"

Closes #5409

See merge request gitlab-org/gitlab-ee!5100
parents 25d51bc7 25fe5196
......@@ -211,6 +211,8 @@ module Geo
raise Gitlab::Shell::Error, 'Can not move original repository out of the way'
end
gitlab_shell.add_namespace(project.repository_storage_path, repository.disk_path)
unless gitlab_shell.mv_repository(project.repository_storage_path, disk_path_temp, repository.disk_path)
raise Gitlab::Shell::Error, 'Can not move temporary repository'
end
......
---
title: 'Geo: Recovery from temporary directory doesn''t work if the namespace directory
doesn''t exist'
merge_request:
author:
type: fixed
......@@ -254,14 +254,21 @@ describe Geo::RepositorySyncService do
expect(subject).to receive(:sync_repository).with(true).and_call_original
expect(subject.gitlab_shell).to receive(:mv_repository).exactly(2).times.and_call_original
expect(subject.gitlab_shell).to receive(:add_namespace).with(
project.repository_storage_path,
"@failed-geo-sync/#{repository.disk_path}"
).and_call_original
expect(subject.gitlab_shell).to receive(:add_namespace).with(
project.repository_storage_path,
repository.disk_path
).and_call_original
expect(subject.gitlab_shell).to receive(:remove_repository).exactly(2).times.and_call_original
subject.execute
# gitlab-shell always appends .git to the end of the repository, so
# we're relying on the fact that projects can't contain + in the name
deleted_dir = File.join(project.repository_storage_path, project.path) + "+failed-geo-sync.git"
expect(File.directory?(deleted_dir)).to be false
expect(File.directory?(project.repository.path)).to be true
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