This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch fix/CAMEL-24466 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 68580aaf15a6ca268a6e52074244463b77b4c718 Author: Claus Ibsen <[email protected]> AuthorDate: Tue Aug 25 07:58:37 2026 +0200 CAMEL-24466: Fix flaky KafkaConsumerHealthCheckIT.testReadinessWhenDown Readiness down-detection relies on the Kafka client's hasReadyNodes(), which only flips after connection-failure detection bounded by request.timeout.ms (default 30s). The 20s Awaitility window was shorter than that bound, so a killed-broker connection was not always detected in time, causing intermittent ConditionTimeout failures in CI (all 3 rerun attempts failed). Widen the await window to 45s and add a method-level @Timeout(60) (overriding the class-level @Timeout(30)) so detection can complete reliably. Both are upper bounds and Awaitility returns as soon as the condition is met, so passing runs are not slowed. Also drop unnecessary public modifiers per JUnit 5 conventions. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../kafka/integration/health/KafkaConsumerHealthCheckIT.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/health/KafkaConsumerHealthCheckIT.java b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/health/KafkaConsumerHealthCheckIT.java index 6d46f6b25223..f608e6548759 100644 --- a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/health/KafkaConsumerHealthCheckIT.java +++ b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/health/KafkaConsumerHealthCheckIT.java @@ -64,7 +64,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @EnabledOnOs(value = { OS.LINUX, OS.MAC, OS.FREEBSD, OS.OPENBSD, OS.WINDOWS }, architectures = { "amd64", "aarch64", "s390x" }, disabledReason = "This test does not run reliably on ppc64le") -public class KafkaConsumerHealthCheckIT extends KafkaHealthCheckTestSupport { +class KafkaConsumerHealthCheckIT extends KafkaHealthCheckTestSupport { public static final String TOPIC = "test-health"; public static final String SKIPPED_HEADER_KEY = "CamelSkippedHeader"; public static final String PROPAGATED_CUSTOM_HEADER = "PropagatedCustomHeader"; @@ -167,15 +167,19 @@ public class KafkaConsumerHealthCheckIT extends KafkaHealthCheckTestSupport { @Order(5) @Test + @Timeout(60) @DisplayName("Tests that readiness reports down when it's actually down") - public void testReadinessWhenDown() { + void testReadinessWhenDown() { CamelContext context = contextExtension.getContext(); // and shutdown Kafka which will make readiness report as DOWN service.shutdown(); serviceShutdown = true; - // health-check readiness should be DOWN - await().atMost(20, TimeUnit.SECONDS).untilAsserted(() -> { + // Detecting a downed broker relies on the Kafka client's hasReadyNodes(), which only flips + // after connection-failure detection bounded by request.timeout.ms (default 30s). The await + // window must therefore exceed 30s (and the method-level @Timeout must exceed the await) to + // avoid a flaky ConditionTimeout under CI load. See CAMEL-24466. + await().atMost(45, TimeUnit.SECONDS).untilAsserted(() -> { Collection<HealthCheck.Result> res2 = HealthCheckHelper.invokeReadiness(context); Assertions.assertTrue(res2.size() > 0); Optional<HealthCheck.Result> down
