[TESTING] Fix Kafka output test

When doing randomized testing, one of the tests failed because kafka was not initialized yet

Fixes #1758
This commit is contained in:
Richard Pijnenburg 2014-09-22 11:46:13 +00:00 committed by Jordan Sissel
parent 7732d2287d
commit e7d41e3c80

View file

@ -26,13 +26,13 @@ describe LogStash::Outputs::Kafka do
end
it "should send logstash event to kafka broker" do
kafka = LogStash::Outputs::Kafka.new(kafka_config)
kafka.register
timestamp = LogStash::Timestamp.now
expect_any_instance_of(Kafka::Producer)
.to receive(:sendMsg)
.with("test", nil, "{\"message\":\"hello world\",\"host\":\"test\",\"@timestamp\":\"#{timestamp}\",\"@version\":\"1\"}")
e = LogStash::Event.new({"message" => "hello world", "host" => "test", "@timestamp" => timestamp})
kafka = LogStash::Outputs::Kafka.new(kafka_config)
kafka.register
kafka.receive(e)
end