Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mensfeld committed Sep 22, 2023
1 parent 89410fa commit 2862dc1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def initialize
let(:counts) { dummy_client.buffer[:count] }
let(:histograms) { dummy_client.buffer[:histogram] }
let(:guages) { dummy_client.buffer[:gauge] }
let(:broker_tag) { { tags: %w[broker:localhost:9092] } }
let(:broker_tag) { { tags: %w[broker:127.0.0.1:9092] } }

# We add all expectations in one example not to sleep each time
it 'expect to have proper metrics in place' do
Expand Down
10 changes: 6 additions & 4 deletions spec/lib/waterdrop/producer/async_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
end

context 'when producing with good middleware' do
let(:message) { build(:valid_message, payload: nil) }

before do
producer.produce_sync(topic: message[:topic], payload: nil)

mid = lambda do |msg|
msg[:partition_key] = '1'
msg
Expand All @@ -36,12 +40,12 @@
producer.middleware.append mid
end

let(:message) { build(:valid_message, payload: nil) }

it { expect(delivery).to be_a(Rdkafka::Producer::DeliveryHandle) }
end

context 'when producing with corrupted middleware' do
let(:message) { build(:valid_message, payload: nil) }

before do
mid = lambda do |msg|
msg[:partition_key] = -1
Expand All @@ -51,8 +55,6 @@
producer.middleware.append mid
end

let(:message) { build(:valid_message, payload: nil) }

it { expect { delivery }.to raise_error(WaterDrop::Errors::MessageInvalidError) }
end

Expand Down
2 changes: 2 additions & 0 deletions spec/lib/waterdrop/producer/sync_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@

let(:message) { build(:valid_message, partition_key: rand.to_s, topic: 'example_topic') }

before { producer.produce_sync(topic: 'example_topic', payload: '1') }

it { expect(delivery).to be_a(Rdkafka::Producer::DeliveryReport) }
end

Expand Down

0 comments on commit 2862dc1

Please sign in to comment.