This is an automated email from the ASF dual-hosted git repository. apupier pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9fe205c155727f2f487e0c71f21fdfeffbe1d5a5 Author: Aurélien Pupier <[email protected]> AuthorDate: Fri Nov 20 10:48:26 2026 +0100 CAMEL-27291: camel-kudu - Wait for the Kudu cluster to be ready in tests The Testcontainers based Kudu cluster only waited for the master and tablet server RPC ports to listen. A listening port does not mean the cluster is usable: the master must have elected itself leader and the tablet server must have registered. A test starting too early, such as KuduClientAutowiredTest, kept retrying CreateTable against the master ("Connection refused", "has no leader") until the 30 seconds client timeout. Wait, with an explicit 60 seconds limit, until the master reports at least one registered tablet server before the tests of a class are run. Co-authored-by: IBM Bob 2.2.1 Signed-off-by: Aurélien Pupier <[email protected]> --- .../camel/component/kudu/IntegrationKuduConfiguration.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/camel-kudu/src/test/java/org/apache/camel/component/kudu/IntegrationKuduConfiguration.java b/components/camel-kudu/src/test/java/org/apache/camel/component/kudu/IntegrationKuduConfiguration.java index 348cb2bc5448..e65b101ae040 100644 --- a/components/camel-kudu/src/test/java/org/apache/camel/component/kudu/IntegrationKuduConfiguration.java +++ b/components/camel-kudu/src/test/java/org/apache/camel/component/kudu/IntegrationKuduConfiguration.java @@ -21,6 +21,7 @@ import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; +import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import com.github.dockerjava.api.command.CreateContainerCmd; @@ -41,6 +42,7 @@ import org.testcontainers.containers.Network; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.Wait; +import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assertions.assertNotNull; /** @@ -138,6 +140,18 @@ public class IntegrationKuduConfiguration implements BeforeAllCallback, AfterAll LOG.info("Kudu tablet server RPC accessible at {}:{}", tabletContainer.getHost(), KUDU_TABLET_RPC_PORT); kuduClient = new KuduClient.KuduClientBuilder(masterAuthority).build(); + awaitClusterReady(); + } + + /** + * A listening RPC port does not mean the cluster is usable: the master must have elected itself leader and the + * tablet server must have registered, otherwise operations such as create table keep retrying until they time out. + */ + private void awaitClusterReady() { + await().atMost(60, TimeUnit.SECONDS) + .pollInterval(500, TimeUnit.MILLISECONDS) + .ignoreExceptions() + .until(() -> kuduClient.listTabletServers().getTabletServersCount() >= 1); } @Override
