From fb19069fe85d85f2e3235d62f2e6d103864d8031 Mon Sep 17 00:00:00 2001 From: adamw Date: Wed, 23 Aug 2023 14:24:15 +0200 Subject: [PATCH] Fix test --- kafka/src/main/scala/ox/kafka/KafkaConsumerActor.scala | 2 +- kafka/src/main/scala/ox/kafka/KafkaSink.scala | 2 +- kafka/src/test/scala/ox/kafka/KafkaTest.scala | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/kafka/src/main/scala/ox/kafka/KafkaConsumerActor.scala b/kafka/src/main/scala/ox/kafka/KafkaConsumerActor.scala index 97a2a092..5318809d 100644 --- a/kafka/src/main/scala/ox/kafka/KafkaConsumerActor.scala +++ b/kafka/src/main/scala/ox/kafka/KafkaConsumerActor.scala @@ -56,7 +56,7 @@ object KafkaConsumerActor: finally if closeWhenComplete then logger.debug("Closing the Kafka consumer") - consumer.close() + uninterruptible(consumer.close()) } c diff --git a/kafka/src/main/scala/ox/kafka/KafkaSink.scala b/kafka/src/main/scala/ox/kafka/KafkaSink.scala index 8de2d5ef..dac1fd76 100644 --- a/kafka/src/main/scala/ox/kafka/KafkaSink.scala +++ b/kafka/src/main/scala/ox/kafka/KafkaSink.scala @@ -96,7 +96,7 @@ object KafkaSink: finally if closeWhenComplete then logger.debug("Closing the Kafka producer") - producer.close() + uninterruptible(producer.close()) } c diff --git a/kafka/src/test/scala/ox/kafka/KafkaTest.scala b/kafka/src/test/scala/ox/kafka/KafkaTest.scala index f96713c1..7cf54202 100644 --- a/kafka/src/test/scala/ox/kafka/KafkaTest.scala +++ b/kafka/src/test/scala/ox/kafka/KafkaTest.scala @@ -64,10 +64,7 @@ class KafkaTest extends AnyFlatSpec with Matchers with EmbeddedKafka with Before // then given Deserializer[String] = new StringDeserializer() - consumeFirstStringMessageFrom(topic) shouldBe "a" - consumeFirstStringMessageFrom(topic) shouldBe "b" - consumeFirstStringMessageFrom(topic) shouldBe "c" -// TODO consumeNumberMessagesFrom[String](topic, 3, timeout = 30.seconds) shouldBe List("a", "b", "c") + consumeNumberMessagesFrom[String](topic, 3, timeout = 30.seconds) shouldBe List("a", "b", "c") } it should "commit offsets of processed messages" in {