Commit 4530d595 authored by Stan Hu's avatar Stan Hu

Geo: Fix Wiki resync when Wiki repository does not exist

Closes #5218
parent 87433f2f
......@@ -205,7 +205,10 @@ module Geo
# Make sure we have a namespace directory
gitlab_shell.add_namespace(project.repository_storage_path, deleted_disk_path_temp)
if project.repository_exists? && !gitlab_shell.mv_repository(project.repository_storage_path, repository.disk_path, deleted_disk_path_temp)
# Make sure we have the most current state of exists?
repository.expire_exists_cache
if 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
......
---
title: 'Geo: Fix Wiki resync when Wiki repository does not exist'
merge_request:
author:
type: fixed
......@@ -309,6 +309,8 @@ describe Geo::RepositorySyncService do
force_to_redownload_repository: true
)
expect(subject).not_to receive(:fail_registry!).and_call_original
subject.execute
end
end
......
......@@ -170,6 +170,22 @@ RSpec.describe Geo::WikiSyncService do
expect(registry.last_wiki_sync_failure).to eq('Error syncing wiki repository: shell error')
end
end
context 'no Wiki repository' do
let(:project) { create(:project, :repository) }
it 'does not raise an error' do
create(
:geo_project_registry,
project: project,
force_to_redownload_wiki: true
)
expect(subject).not_to receive(:fail_registry!).and_call_original
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