Skip to content

Commit

Permalink
improve specs stability (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
mensfeld authored Oct 30, 2023
1 parent 8bec719 commit 07eae52
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/lib/waterdrop/instrumentation/callbacks/delivery_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
end

producer.produce_sync(message)

sleep(0.01) until changed.size.positive?
end

it { expect(event.payload[:partition]).to eq(0) }
Expand Down Expand Up @@ -92,6 +94,8 @@
rescue Rdkafka::RdkafkaError
nil
end

sleep(0.01) until changed.size.positive?
end

it { expect(event.payload[:error]).to be_a(Rdkafka::RdkafkaError) }
Expand All @@ -117,6 +121,8 @@
rescue WaterDrop::Errors::ProduceError => e
errors << e
end

sleep(0.01) until changed.size.positive?
end

it { expect(errors.first).to be_a(WaterDrop::Errors::ProduceError) }
Expand All @@ -141,6 +147,8 @@

producer.produce_async(build(:valid_message))
producer.purge

sleep(0.01) until errors.size.positive?
end

it 'expect to have it in the errors' do
Expand Down

0 comments on commit 07eae52

Please sign in to comment.