Commit 2f5eb166 authored by Michael Kozono's avatar Michael Kozono

Merge branch...

Merge branch '350359-geo-error-undefined-method-separate_verification_state_table-spec' into 'master'

Adds spec to check VerificationTimeoutWorker basic functionality

See merge request gitlab-org/gitlab!78596
parents 34ede077 52f910d9
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Geo::VerificationTimeoutWorker, :geo do RSpec.describe Geo::VerificationTimeoutWorker, :geo do
let(:replicable_name) { 'widget' } include ::EE::GeoHelpers
let(:replicator_class) { double('widget_replicator_class') }
let(:replicable_name) { 'snippet_repository' }
it 'uses a Geo queue' do it 'uses a Geo queue' do
expect(described_class.new.sidekiq_options_hash).to include( expect(described_class.new.sidekiq_options_hash).to include(
...@@ -13,7 +14,25 @@ RSpec.describe Geo::VerificationTimeoutWorker, :geo do ...@@ -13,7 +14,25 @@ RSpec.describe Geo::VerificationTimeoutWorker, :geo do
) )
end 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
let(:replicator_class) { double('snippet_repository_replicator_class') }
before do before do
allow(::Gitlab::Geo::Replicator).to receive(:for_replicable_name).with(replicable_name).and_return(replicator_class) 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