Skip to content

Commit 6daeb22

Browse files
Richard Pijnenburgjordansissel
authored andcommitted
[TESTING] Fix Kafka output test
When doing randomized testing, one of the tests failed because kafka was not initialized yet Fixes #1758
1 parent 42fa9ea commit 6daeb22

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spec/outputs/kafka_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
end
2727

2828
it "should send logstash event to kafka broker" do
29+
kafka = LogStash::Outputs::Kafka.new(kafka_config)
30+
kafka.register
2931
timestamp = LogStash::Timestamp.now
3032
expect_any_instance_of(Kafka::Producer)
3133
.to receive(:sendMsg)
3234
.with("test", nil, "{\"message\":\"hello world\",\"host\":\"test\",\"@timestamp\":\"#{timestamp}\",\"@version\":\"1\"}")
3335
e = LogStash::Event.new({"message" => "hello world", "host" => "test", "@timestamp" => timestamp})
34-
kafka = LogStash::Outputs::Kafka.new(kafka_config)
35-
kafka.register
3636
kafka.receive(e)
3737
end
3838

0 commit comments

Comments
 (0)