From: Kai Moritz Date: Sat, 24 Feb 2024 19:15:26 +0000 (+0100) Subject: WIP:wait X-Git-Tag: rebase--2024-02-26--19-46~11 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=ed9188cae04dbc2372e5c39280b43d3af3af42d5;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 30c86c83..b84d540e 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverIT.java @@ -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 diff --git a/src/test/resources/haproxy.cfg b/src/test/resources/haproxy.cfg index ad9bb8fe..28e889a8 100644 --- a/src/test/resources/haproxy.cfg +++ b/src/test/resources/haproxy.cfg @@ -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