You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2023/02/17 11:14:24 UTC

[camel] 02/02: CAMEL-19070: camel-elasticsearch - Increase startup timeout for slow build pipelines

This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch CAMEL-19070/increase-startup-timeout
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e8c6df7a16b8bc976e4d099e7dc485cd5b8fa23e
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Fri Feb 17 12:13:55 2023 +0100

    CAMEL-19070: camel-elasticsearch - Increase startup timeout for slow build pipelines
---
 .../component/es/integration/ElasticsearchTestSupport.java     | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/components/camel-elasticsearch/src/test/java/org/apache/camel/component/es/integration/ElasticsearchTestSupport.java b/components/camel-elasticsearch/src/test/java/org/apache/camel/component/es/integration/ElasticsearchTestSupport.java
index 9992aeecc38..5d8377a6348 100644
--- a/components/camel-elasticsearch/src/test/java/org/apache/camel/component/es/integration/ElasticsearchTestSupport.java
+++ b/components/camel-elasticsearch/src/test/java/org/apache/camel/component/es/integration/ElasticsearchTestSupport.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.es.integration;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.time.Duration;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -44,6 +45,7 @@ import org.junit.jupiter.api.TestInstance;
 import org.junit.jupiter.api.extension.RegisterExtension;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
 import org.testcontainers.utility.Base58;
 
 @TestInstance(TestInstance.Lifecycle.PER_CLASS)
@@ -88,7 +90,13 @@ public class ElasticsearchTestSupport extends CamelTestSupport {
         ret.getContainer()
                 .withNetworkAliases("elasticsearch-" + Base58.randomString(6))
                 .withPassword(PASSWORD)
-                .withExposedPorts(ELASTICSEARCH_DEFAULT_PORT, ELASTICSEARCH_DEFAULT_TCP_PORT);
+                .withExposedPorts(ELASTICSEARCH_DEFAULT_PORT, ELASTICSEARCH_DEFAULT_TCP_PORT)
+                // Increase the timeout from 60 seconds to 90 seconds to ensure that it will be long enough
+                // on the build pipeline
+                .setWaitStrategy(
+                        new LogMessageWaitStrategy()
+                                .withRegEx(".*(\"message\":\\s?\"started[\\s?|\"].*|] started\n$)")
+                                .withStartupTimeout(Duration.ofSeconds(90)));
 
         return ret;
     }