Commit f2979986 authored by Mike Kozono's avatar Mike Kozono

Perform Replicator#verify even if not "started"

* `Geo::VerificationWorker` is already deduplicated for identical args
  since it is marked `idempotent!`
* When `verification_state` is not `verification_started`, it is not
  necessary for `VerificationWorker#perform` or `Replicator#verify` to
  exit without doing work. Furthermore, it is unexpected.
parent 465e5f66
...@@ -126,8 +126,7 @@ module Geo ...@@ -126,8 +126,7 @@ module Geo
# Calculates checksum and asks the model/registry to update verification # Calculates checksum and asks the model/registry to update verification
# state. # state.
def verify def verify
# Deduplicate verification job model_record.verification_started! unless model_record.verification_started?
return unless model_record.verification_started?
calculation_started_at = Time.current calculation_started_at = Time.current
checksum = model_record.calculate_checksum checksum = model_record.calculate_checksum
......
...@@ -299,11 +299,6 @@ RSpec.shared_examples 'a verifiable replicator' do ...@@ -299,11 +299,6 @@ RSpec.shared_examples 'a verifiable replicator' do
stub_primary_node stub_primary_node
end end
context 'when verification was started' do
before do
model_record.verification_started!
end
context 'when the checksum succeeds' do context 'when the checksum succeeds' do
it 'delegates checksum calculation and the state change to model_record' do it 'delegates checksum calculation and the state change to model_record' do
expect(model_record).to receive(:calculate_checksum).and_return('abc123') expect(model_record).to receive(:calculate_checksum).and_return('abc123')
...@@ -326,14 +321,5 @@ RSpec.shared_examples 'a verifiable replicator' do ...@@ -326,14 +321,5 @@ RSpec.shared_examples 'a verifiable replicator' do
end end
end end
end end
context 'when verification was not started' do
it 'does not call calculate_checksum!' do
expect(model_record).not_to receive(:calculate_checksum)
replicator.verify
end
end
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