Skip to content

Commit

Permalink
Reset internal producer after each spec
Browse files Browse the repository at this point in the history
  • Loading branch information
deepredsky committed Jul 3, 2024
1 parent bdee35c commit fe905df
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spec/producer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
allow(producer).to receive(:internal_producer).and_return(double("Rdkafka::Producer", :produce => delivery_handle))
end

after do
Racecar::Producer.shutdown!
Racecar::Producer.class_variable_set(:@@init_internal_producer, nil)
end


describe "#produce_async" do
it "sends the message without waiting for feedback or guarantees" do
expect(producer.produce_async(value: value, topic: topic)).to be_nil
Expand All @@ -31,7 +37,7 @@
describe "#wait_for_delivery" do
it "sends the message and waits for a delivery handle" do
expect(delivery_handle).to receive(:wait).exactly(5).times

producer.wait_for_delivery do
5.times do |message|
producer.produce_async(value: message.to_s, topic: topic)
Expand Down

0 comments on commit fe905df

Please sign in to comment.