Commit 10b803c2 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'mk/refactor-verify' into 'master'

Geo: Minor adjustments to verification logic

See merge request gitlab-org/gitlab!49292
parents f5aaf89a 30e6a4d8
......@@ -126,8 +126,7 @@ module Geo
# Calculates checksum and asks the model/registry to update verification
# state.
def verify
# Deduplicate verification job
return unless model_record.verification_started?
model_record.verification_started! unless model_record.verification_started?
calculation_started_at = Time.current
checksum = model_record.calculate_checksum
......
......@@ -81,7 +81,7 @@ module Gitlab
end
event :verification_failed do
transition verification_started: :verification_failed
transition [:verification_pending, :verification_started, :verification_succeeded, :verification_failed] => :verification_failed
end
event :verification_pending do
......
......@@ -299,11 +299,6 @@ RSpec.shared_examples 'a verifiable replicator' do
stub_primary_node
end
context 'when verification was started' do
before do
model_record.verification_started!
end
context 'when the checksum succeeds' do
it 'delegates checksum calculation and the state change to model_record' do
expect(model_record).to receive(:calculate_checksum).and_return('abc123')
......@@ -326,14 +321,5 @@ RSpec.shared_examples 'a verifiable replicator' do
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
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