Fix expectations order due to the ordering clause removed in the finder

parent ca162184
...@@ -121,56 +121,30 @@ describe Geo::RepositoryVerification::Primary::ShardWorker, :postgresql, :clean_ ...@@ -121,56 +121,30 @@ describe Geo::RepositoryVerification::Primary::ShardWorker, :postgresql, :clean_
let(:project_both_failed) { create(:repository_state, :repository_failed, :wiki_failed).project } let(:project_both_failed) { create(:repository_state, :repository_failed, :wiki_failed).project }
let(:project_repo_unverified) { create(:repository_state).project } let(:project_repo_unverified) { create(:repository_state).project }
let(:project_wiki_unverified) { create(:repository_state).project } let(:project_wiki_unverified) { create(:repository_state).project }
let(:project_repo_failed_wiki_verified) { create(:repository_state, :repository_failed, :wiki_verified).project }
let(:project_repo_verified_wiki_failed) { create(:repository_state, :repository_verified, :wiki_failed).project }
it 'handles multiple batches of projects needing verification' do it 'handles multiple batches of projects needing verification' do
project1 = project_repo_unverified expect(primary_singleworker).to receive(:perform_async).with(project_repo_unverified.id).once.and_call_original
project2 = project_wiki_unverified expect(primary_singleworker).to receive(:perform_async).with(project_wiki_unverified.id).once.and_call_original
expect(primary_singleworker).to receive(:perform_async).with(project1.id).once 3.times do
Sidekiq::Testing.inline! { subject.perform(shard_name) }
subject.perform(shard_name) end
project1.repository_state.update_attributes!(
repository_verification_checksum: 'f079a831cab27bcda7d81cd9b48296d0c3dd92ee',
wiki_verification_checksum: 'e079a831cab27bcda7d81cd9b48296d0c3dd92ef')
expect(primary_singleworker).to receive(:perform_async).with(project2.id).once
subject.perform(shard_name)
end end
it 'handles multiple batches of projects needing verification, skipping failed repos' do it 'handles multiple batches of projects needing verification, skipping failed repos' do
project1 = project_repo_unverified expect(primary_singleworker).to receive(:perform_async).with(project_repo_unverified.id).once.and_call_original
project2 = project_wiki_unverified expect(primary_singleworker).to receive(:perform_async).with(project_wiki_unverified.id).once.and_call_original
project3 = project_both_failed # rubocop:disable Lint/UselessAssignment expect(primary_singleworker).to receive(:perform_async).with(project_repo_verified.id).once.and_call_original
project4 = project_repo_verified expect(primary_singleworker).to receive(:perform_async).with(project_wiki_verified.id).once.and_call_original
project5 = project_wiki_verified expect(primary_singleworker).not_to receive(:perform_async).with(project_both_failed.id)
expect(primary_singleworker).not_to receive(:perform_async).with(project_repo_failed_wiki_verified.id)
expect(primary_singleworker).to receive(:perform_async).with(project1.id).once expect(primary_singleworker).not_to receive(:perform_async).with(project_repo_verified_wiki_failed.id)
subject.perform(shard_name) 8.times do
Sidekiq::Testing.inline! { subject.perform(shard_name) }
project1.repository_state.update_attributes!( end
repository_verification_checksum: 'f079a831cab27bcda7d81cd9b48296d0c3dd92ee',
wiki_verification_checksum: 'e079a831cab27bcda7d81cd9b48296d0c3dd92ef')
expect(primary_singleworker).to receive(:perform_async).with(project2.id).once
subject.perform(shard_name)
project2.repository_state.update_attributes!(
repository_verification_checksum: 'f079a831cab27bcda7d81cd9b48296d0c3dd92ee',
wiki_verification_checksum: 'e079a831cab27bcda7d81cd9b48296d0c3dd92ef')
expect(primary_singleworker).to receive(:perform_async).with(project4.id).once
subject.perform(shard_name)
project4.repository_state.update_attributes!(last_wiki_verification_failure: 'Failed!')
expect(primary_singleworker).to receive(:perform_async).with(project5.id).once
subject.perform(shard_name)
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