WIP:wait
authorKai Moritz <kai@juplo.de>
Sat, 24 Feb 2024 19:15:26 +0000 (20:15 +0100)
committerKai Moritz <kai@juplo.de>
Sat, 24 Feb 2024 19:15:26 +0000 (20:15 +0100)
src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverIT.java
src/test/resources/haproxy.cfg

index 30c86c8..b84d540 100644 (file)
@@ -132,6 +132,35 @@ class KafkaHandoverIT extends AbstractHandoverIT
               }
             })
             .block());
+
+    HAPROXY
+        .getDockerClient()
+        .killContainerCmd(HAPROXY.getContainerId())
+        .withSignal("HUP")
+        .exec();
+
+
+    Awaitility
+        .await()
+        .atMost(Duration.ofMinutes(10))
+        .until(() -> webClient
+            .get()
+            .uri("/actuator/health")
+            .exchangeToMono(response ->
+            {
+              if (response.statusCode().equals(HttpStatus.OK))
+              {
+                return response
+                    .bodyToMono(StatusTo.class)
+                    .map(StatusTo::getStatus)
+                    .map(status -> status.equalsIgnoreCase("UP"));
+              }
+              else
+              {
+                return Mono.just(false);
+              }
+            })
+            .block());
   }
 
   WebClient webClient;
@@ -174,8 +203,8 @@ class KafkaHandoverIT extends AbstractHandoverIT
         result.getStdout());
 
     BACKEND_1.start();
-    // BACKEND_2.start();
-    // BACKEND_3.start();
+    BACKEND_2.start();
+    BACKEND_3.start();
   }
 
   static Network NETWORK = Network.newNetwork();
@@ -262,7 +291,7 @@ class KafkaHandoverIT extends AbstractHandoverIT
               "sharding.map",
               "/usr/local/etc/haproxy/sharding.map",
               BindMode.READ_WRITE)
-          .withExposedPorts(8400) // , 8401, 8404, 5555)
+          .withExposedPorts(8400, 8401, 8404)
           .withLogConsumer(new Slf4jLogConsumer(log, true).withPrefix("HAPROXY"));
 
   @EqualsAndHashCode
index ad9bb8f..28e889a 100644 (file)
@@ -6,13 +6,16 @@ defaults
   timeout server 10m
   timeout http-request 10s
   log global
-  default-server init-addr none
+  default-server init-addr last,libc,none
 
 global
   stats socket ipv4@:8401 level admin
   stats socket /var/run/haproxy.sock mode 666 level admin
   stats timeout 2m
 
+resolvers docker
+  parse-resolv-conf
+
 frontend stats
   bind *:8404
   stats enable