I'm using embedded Kafka to do some integration test. My code insert one element in Kafka and I check in my test that this record is right. I have many tests that have this behavior. If I execute a single test, it always work, but if I execute all the test, some of them could fail randomly.
java.util.concurrent.TimeoutException: Unable to retrieve a message from Kafka in 5000ms
My code:
val recordFromKafka = DesMyClass.deserialize(EmbeddedKafka.consumeFirstMessageFrom(topic))
assertResult(result) {
recordFromKafka
}
at net.manub.embeddedkafka.EmbeddedKafkaSupport$$anonfun$3.apply(EmbeddedKafka.scala:221)
I get this error and the next test fails too because I recover the record from the last test,, producing a chain of errors.
It seems that it's a problem from Kafka. Any idea? I have thought to call again the operation consumeFirstMessageFrom if I don't get any record,, but it doesn't seem a good way to do it.
Aucun commentaire:
Enregistrer un commentaire