From 7754fb2f645afad06134c74d3674af45fdc362f6 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 14 Sep 2023 00:15:22 +0200 Subject: [PATCH] WIP --- .../kafka/KafkaChatHomeServiceTest.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/test/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeServiceTest.java b/src/test/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeServiceTest.java index 33b41442..781781b1 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeServiceTest.java +++ b/src/test/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeServiceTest.java @@ -18,9 +18,12 @@ import org.springframework.context.annotation.Import; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.support.SendResult; import org.springframework.kafka.test.context.EmbeddedKafka; +import org.testcontainers.shaded.org.awaitility.Awaitility; import java.time.Clock; +import java.time.Duration; import java.util.List; +import java.util.UUID; import static de.juplo.kafka.chat.backend.domain.ChatHomeServiceWithShardsTest.NUM_SHARDS; import static de.juplo.kafka.chat.backend.implementation.kafka.KafkaChatHomeServiceTest.DATA_TOPIC; @@ -59,10 +62,19 @@ public class KafkaChatHomeServiceTest extends ChatHomeServiceWithShardsTest static class KafkaChatHomeTestConfiguration { @Bean - KafkaServicesApplicationRunner.WorkAssignor workAssignor(DataChannel dataChannel) + KafkaServicesApplicationRunner.WorkAssignor workAssignor( + InfoChannel infoChannel, + DataChannel dataChannel) { return consumer -> { + // TODO: Darauf warten, dass der Chat-Room erzeugt wurde! + Awaitility + .await() + .atMost(Duration.ofSeconds(10)) + .until(() -> infoChannel + .getChatRoomInfo(UUID.fromString("5c73531c-6fc4-426c-adcb-afc5c140a0f7")) + .block() != null); List assignedPartitions = List.of(new TopicPartition(DATA_TOPIC, 2)); consumer.assign(assignedPartitions); -- 2.20.1