Commit 253ff600 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'tc-fix-12455' into 'master'

Geo: fix flaky failure in secondary/shard_worker_spec.rb

Closes #12455

See merge request gitlab-org/gitlab!17674
parents b0af1d97 87471cbe
......@@ -95,23 +95,18 @@ describe Geo::RepositoryVerification::Secondary::ShardWorker, :geo, :geo_fdw, :r
let(:project5_both_verified) { create(:repository_state, :repository_verified, :wiki_verified).project }
let(:project6_both_verified) { create(:repository_state, :repository_verified, :wiki_verified).project }
# https://gitlab.com/gitlab-org/gitlab/issues/12455
it 'handles multiple batches of projects needing verification' do
reg1 = create(:geo_project_registry, :synced, :repository_verification_outdated, project: project1_repo_verified)
reg2 = create(:geo_project_registry, :synced, :repository_verification_outdated, project: project2_repo_verified)
expect(secondary_single_worker).to receive(:perform_async).with(reg1.id).once
expect(secondary_single_worker).to receive(:perform_async).with(reg1.id).once.and_call_original
expect(secondary_single_worker).to receive(:perform_async).with(reg2.id).once.and_call_original
subject.perform(shard_name)
reg1.update!(repository_verification_checksum_sha: project1_repo_verified.repository_state.repository_verification_checksum)
expect(secondary_single_worker).to receive(:perform_async).with(reg2.id).once
subject.perform(shard_name)
3.times do
Sidekiq::Testing.inline! { subject.perform(shard_name) }
end
end
# https://gitlab.com/gitlab-org/gitlab/issues/12455
it 'handles multiple batches of projects needing verification, skipping failed repos' do
reg1 = create(:geo_project_registry, :synced, :repository_verification_outdated, project: project1_repo_verified)
reg2 = create(:geo_project_registry, :synced, :repository_verification_outdated, project: project2_repo_verified)
......@@ -120,27 +115,14 @@ describe Geo::RepositoryVerification::Secondary::ShardWorker, :geo, :geo_fdw, :r
create(:geo_project_registry, :synced, :repository_verification_failed, :wiki_verification_failed, project: project5_both_verified)
reg6 = create(:geo_project_registry, :synced, project: project6_both_verified)
expect(secondary_single_worker).to receive(:perform_async).with(reg1.id).once
subject.perform(shard_name)
reg1.update!(repository_verification_checksum_sha: project1_repo_verified.repository_state.repository_verification_checksum)
expect(secondary_single_worker).to receive(:perform_async).with(reg2.id).once
expect(secondary_single_worker).to receive(:perform_async).with(reg1.id).once.and_call_original
expect(secondary_single_worker).to receive(:perform_async).with(reg2.id).once.and_call_original
expect(secondary_single_worker).to receive(:perform_async).with(reg4.id).once.and_call_original
expect(secondary_single_worker).to receive(:perform_async).with(reg6.id).once.and_call_original
subject.perform(shard_name)
reg2.update!(repository_verification_checksum_sha: project2_repo_verified.repository_state.repository_verification_checksum)
expect(secondary_single_worker).to receive(:perform_async).with(reg4.id).once
subject.perform(shard_name)
reg4.update!(last_wiki_verification_failure: 'Failed!')
expect(secondary_single_worker).to receive(:perform_async).with(reg6.id).once
subject.perform(shard_name)
7.times do
Sidekiq::Testing.inline! { subject.perform(shard_name) }
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