Commit 0a93fe5d authored by Valery Sizov's avatar Valery Sizov

Geo: Recovery from temporary directory doesn't work if the namespace directory doesn't exist

parent 2e8135d0
......@@ -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
......
......@@ -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