Commit cbe9cbc4 authored by James Lopez's avatar James Lopez

add a couple more specs

parent b2d0410c
......@@ -21,7 +21,7 @@ module Geo
fetch_geo_mirror(project.wiki.repository)
end
update_registry!(finished_at: DateTime.now, attrs: { last_wiki_sync_failure: nil})
update_registry!(finished_at: DateTime.now, attrs: { last_wiki_sync_failure: nil })
log_info('Finished wiki sync',
update_delay_s: update_delay_in_seconds,
......
......@@ -52,6 +52,12 @@ describe Geo::RepositorySyncService do
subject.execute
end
it 'voids the failure message when it succeeds after an error' do
registry = create(:geo_project_registry, project: project, last_repository_sync_failure: 'error')
expect { subject.execute }.to change { registry.reload.last_repository_sync_failure}.to(nil)
end
it 'returns the lease when sync fail' do
allow(repository).to receive(:fetch_as_mirror).with(url_to_repo, forced: true) { raise Gitlab::Shell::Error }
......
......@@ -44,6 +44,12 @@ RSpec.describe Geo::WikiSyncService do
subject.execute
end
it 'voids the failure message when it succeeds after an error' do
registry = create(:geo_project_registry, project: project, last_wiki_sync_failure: 'error')
expect { subject.execute }.to change { registry.reload.last_wiki_sync_failure}.to(nil)
end
it 'does not fetch wiki repository if cannot obtain a lease' do
allow(lease).to receive(:try_obtain) { false }
......
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