From: Kai Moritz Date: Sat, 24 Feb 2024 18:13:42 +0000 (+0100) Subject: WIP:wait X-Git-Tag: rebase--2024-02-26--19-46~12 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=bf30934f58801fded36a8ff52b362856f055a261;p=demos%2Fkafka%2Fchat WIP:wait --- diff --git a/src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverIT.java b/src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverIT.java index c8f6b299..30c86c83 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverIT.java @@ -22,6 +22,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.io.IOException; +import java.time.Duration; import java.util.stream.IntStream; @@ -39,6 +40,8 @@ class KafkaHandoverIT extends AbstractHandoverIT Thread.sleep(10000); receiveMessage(chatRoom).subscribe(message -> log.info("message: {}", message)); + + Thread.sleep(1000000); } Mono createChatRoom(String name) @@ -109,7 +112,9 @@ class KafkaHandoverIT extends AbstractHandoverIT Awaitility .await() - .until(() -> webClient + .atMost(Duration.ofMinutes(10)) + .until(() -> WebClient + .create("http://localhost:" + BACKEND_1.getMappedPort(8080)) .get() .uri("/actuator/health") .exchangeToMono(response -> @@ -127,8 +132,6 @@ class KafkaHandoverIT extends AbstractHandoverIT } }) .block()); - - log.info("Some backend was UP"); } WebClient webClient; @@ -201,6 +204,7 @@ class KafkaHandoverIT extends AbstractHandoverIT "--chat.backend.kafka.haproxy-runtime-api=haproxy:8401", "--chat.backend.kafka.haproxy-map=/usr/local/etc/haproxy/sharding.map" ) + .withExposedPorts(8080) .dependsOn(KAFKA) .waitingFor(Wait.forLogMessage(".*Started\\ ChatBackendApplication.*\\n", 1)) .withLogConsumer(new Slf4jLogConsumer(log, true).withPrefix("BACKEND-1")); @@ -220,6 +224,7 @@ class KafkaHandoverIT extends AbstractHandoverIT "--chat.backend.kafka.haproxy-runtime-api=haproxy:8401", "--chat.backend.kafka.haproxy-map=/usr/local/etc/haproxy/sharding.map" ) + .withExposedPorts(8080) .dependsOn(KAFKA) .waitingFor(Wait.forLogMessage(".*Started\\ ChatBackendApplication.*\\n", 1)) .withLogConsumer(new Slf4jLogConsumer(log, true).withPrefix("BACKEND-2")); @@ -240,6 +245,7 @@ class KafkaHandoverIT extends AbstractHandoverIT "--chat.backend.kafka.haproxy-runtime-api=haproxy:8401", "--chat.backend.kafka.haproxy-map=/usr/local/etc/haproxy/sharding.map" ) + .withExposedPorts(8080) .dependsOn(KAFKA) .waitingFor(Wait.forLogMessage(".*Started\\ ChatBackendApplication.*\\n", 1)) .withLogConsumer(new Slf4jLogConsumer(log, true).withPrefix("BACKEND-3"));