Skip to content

Commit ca8efac

Browse files
authored
add more specs (#612)
1 parent 296779f commit ca8efac

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec/rdkafka/producer_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,25 @@ def call(_, handle)
679679
end
680680
end
681681

682+
context "when topic does not exist and allow.auto.create.topics is false" do
683+
let(:producer) do
684+
rdkafka_producer_config(
685+
"bootstrap.servers": "localhost:9092",
686+
"message.timeout.ms": 100,
687+
"allow.auto.create.topics": false
688+
).producer
689+
end
690+
691+
it "should contain the error in the response when not deliverable" do
692+
handler = producer.produce(topic: "it-#{SecureRandom.uuid}", payload: nil, label: 'na')
693+
# Wait for the async callbacks and delivery registry to update
694+
sleep(2)
695+
expect(handler.create_result.error).to be_a(Rdkafka::RdkafkaError)
696+
expect(handler.create_result.error.code).to eq(:msg_timed_out)
697+
expect(handler.create_result.label).to eq('na')
698+
end
699+
end
700+
682701
describe '#partition_count' do
683702
it { expect(producer.partition_count('consume_test_topic')).to eq(3) }
684703

0 commit comments

Comments
 (0)