WIP:wait
authorKai Moritz <kai@juplo.de>
Sat, 24 Feb 2024 18:13:42 +0000 (19:13 +0100)
committerKai Moritz <kai@juplo.de>
Sat, 24 Feb 2024 18:13:42 +0000 (19:13 +0100)
src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverIT.java

index c8f6b29..30c86c8 100644 (file)
@@ -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<ChatRoomInfoTo> 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"));