Commit 74036b23 authored by Stan Hu's avatar Stan Hu

Add specs for repository and Wiki sync logging

parent aea9108a
......@@ -79,17 +79,24 @@ RSpec.describe Geo::RepositorySyncService do
context 'when repository sync succeed' do
let(:registry) { Geo::ProjectRegistry.find_by(project_id: project.id) }
before do
it 'sets last_repository_synced_at' do
subject.execute
end
it 'sets last_repository_synced_at' do
expect(registry.last_repository_synced_at).not_to be_nil
end
it 'sets last_repository_successful_sync_at' do
subject.execute
expect(registry.last_repository_successful_sync_at).not_to be_nil
end
it 'logs success with timings' do
allow(Gitlab::Geo::Logger).to receive(:info).and_call_original
expect(Gitlab::Geo::Logger).to receive(:info).with(hash_including(:message, :update_delay_s, :download_time_s)).and_call_original
subject.execute
end
end
context 'when repository sync fail' do
......
......@@ -69,17 +69,24 @@ RSpec.describe Geo::WikiSyncService do
context 'when repository sync succeed' do
let(:registry) { Geo::ProjectRegistry.find_by(project_id: project.id) }
before do
it 'sets last_wiki_synced_at' do
subject.execute
end
it 'sets last_wiki_synced_at' do
expect(registry.last_wiki_synced_at).not_to be_nil
end
it 'sets last_wiki_successful_sync_at' do
subject.execute
expect(registry.last_wiki_successful_sync_at).not_to be_nil
end
it 'logs success with timings' do
allow(Gitlab::Geo::Logger).to receive(:info).and_call_original
expect(Gitlab::Geo::Logger).to receive(:info).with(hash_including(:message, :update_delay_s, :download_time_s)).and_call_original
subject.execute
end
end
context 'when wiki sync fail' do
......
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