Commit 19d0bbdd authored by Valery Sizov's avatar Valery Sizov

Adds spec to check VerificationTimeoutWorker basic functionality

parent ed96cd1c
......@@ -3,8 +3,10 @@
require 'spec_helper'
RSpec.describe Geo::VerificationTimeoutWorker, :geo do
let(:replicable_name) { 'widget' }
let(:replicator_class) { double('widget_replicator_class') }
include ::EE::GeoHelpers
let(:replicable_name) { 'snippet_repository' }
let(:replicator_class) { double('snippet_repository_replicator_class') }
it 'uses a Geo queue' do
expect(described_class.new.sidekiq_options_hash).to include(
......@@ -13,7 +15,23 @@ RSpec.describe Geo::VerificationTimeoutWorker, :geo do
)
end
describe '#perform' do
describe 'perform' do
context 'secondary node' do
before do
stub_secondary_node
end
it 'fails timed out records on secondary' do
registry = create(:geo_snippet_repository_registry, :synced, verification_state: Geo::VerificationState::VERIFICATION_STATE_VALUES[:verification_started], verification_started_at: 3.days.ago)
described_class.new.perform(replicable_name)
expect(registry.reload.verification_state).to eq Geo::VerificationState::VERIFICATION_STATE_VALUES[:verification_failed]
end
end
end
describe 'idempotent behaviour' do
before do
allow(::Gitlab::Geo::Replicator).to receive(:for_replicable_name).with(replicable_name).and_return(replicator_class)
......
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