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
The following commit(s) were added to refs/heads/main by this push:
new 7d63d63bd8d CAMEL-22111 - workaround for
ElasticsearchRestClientComponentIT.testProducer
7d63d63bd8d is described below
commit 7d63d63bd8d2c4ca435eecc3bb5d9f6372f007da
Author: Aurélien Pupier <[email protected]>
AuthorDate: Wed May 28 15:45:28 2025 +0200
CAMEL-22111 - workaround for
ElasticsearchRestClientComponentIT.testProducer
It avoids this kind of error:
```
Caused by: org.elasticsearch.client.ResponseException: method [PUT],
host [https://localhost:47378], URI [/my_index], status line [HTTP/1.1
401 Unauthorized]
```
There is already a specific waitStrategy for the container to be ready.
Maybe there could be a way to ensure that everything is ready correctly
with a more precise/different pattern
org.apache.camel.test.infra.elasticsearch.services.ElasticSearchLocalContainerInfraService.initContainer(String)
Locally got 50% success wit 1s sleep and 100% with 2s, so putting 5
seconds to take a margin on the CI and potentially slower machine
Signed-off-by: Aurélien Pupier <[email protected]>
---
.../rest/client/integration/ElasticsearchRestClientComponentIT.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git
a/components/camel-elasticsearch-rest-client/src/test/java/org/apache/camel/component/elasticsearch/rest/client/integration/ElasticsearchRestClientComponentIT.java
b/components/camel-elasticsearch-rest-client/src/test/java/org/apache/camel/component/elasticsearch/rest/client/integration/ElasticsearchRestClientComponentIT.java
index 2739337598b..8abd876d8b9 100644
---
a/components/camel-elasticsearch-rest-client/src/test/java/org/apache/camel/component/elasticsearch/rest/client/integration/ElasticsearchRestClientComponentIT.java
+++
b/components/camel-elasticsearch-rest-client/src/test/java/org/apache/camel/component/elasticsearch/rest/client/integration/ElasticsearchRestClientComponentIT.java
@@ -81,6 +81,10 @@ public class ElasticsearchRestClientComponentIT extends
ElasticsearchRestClientI
@Test
void testProducer() throws ExecutionException, InterruptedException {
+
+ // Workaround to avoid the Credential Provider to not be ready and to
receive a 401
+ Thread.sleep(5000);
+
// create index
CompletableFuture<Boolean> ack =
template.asyncRequestBody("direct:create-index", null, Boolean.class);
assertTrue(ack.get());