Create a Geo::ResetChecksumEvent after the checksum calculation

parent 0edad945
......@@ -9,6 +9,8 @@ module Geo
def execute
verify_checksum(:repository, project.repository)
verify_checksum(:wiki, project.wiki.repository)
Geo::ResetChecksumEventStore.new(project).create!
end
private
......
require 'spec_helper'
describe Geo::RepositoryVerificationPrimaryService do
include EE::GeoHelpers
let(:project) { create(:project) }
let(:repository) { double(checksum: 'f123') }
let(:wiki) { double(checksum: 'e321') }
......@@ -142,6 +144,24 @@ describe Geo::RepositoryVerificationPrimaryService do
)
end
context 'when running on a primary node' do
before do
stub_primary_node
end
it 'does not create a Geo::ResetChecksumEvent event if there are no secondary nodes' do
allow(Gitlab::Geo).to receive(:secondary_nodes) { [] }
expect { subject.execute }.not_to change(Geo::ResetChecksumEvent, :count)
end
it 'creates a Geo::ResetChecksumEvent event' do
allow(Gitlab::Geo).to receive(:secondary_nodes) { [build(:geo_node)] }
expect { subject.execute }.to change(Geo::ResetChecksumEvent, :count).by(1)
end
end
context 'when checksum calculation fails' do
before do
stub_project_repository(project, repository)
......
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