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

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/2.13.x by this push:
     new 2d4bc8e175 Poll telegram stop-location endpoint to avoid sporadic 
failures
2d4bc8e175 is described below

commit 2d4bc8e17563d6fe6a307e21c772362e44ee50dc
Author: James Netherton <jamesnether...@gmail.com>
AuthorDate: Fri Jan 6 09:27:58 2023 +0000

    Poll telegram stop-location endpoint to avoid sporadic failures
---
 .../quarkus/component/telegram/it/TelegramTest.java   | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git 
a/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java
 
b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java
index c797f6fac3..6e56990ac3 100644
--- 
a/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java
+++ 
b/integration-tests/telegram/src/test/java/org/apache/camel/quarkus/component/telegram/it/TelegramTest.java
@@ -184,12 +184,19 @@ public class TelegramTest {
         final StopMessageLiveLocationMessage stop = new 
StopMessageLiveLocationMessage();
         stop.setChatId(result.getMessage().getChat().getId());
         stop.setMessageId(result.getMessage().getMessageId());
-        RestAssured.given()
-                .contentType(ContentType.JSON)
-                .body(stop)
-                .post("/telegram/stop-location")
-                .then()
-                .statusCode(201);
+        // Poll until success as there's some potential for HTTP 400 responses 
to sometimes be returned
+        Awaitility.await()
+                .pollDelay(500, TimeUnit.MILLISECONDS)
+                .pollInterval(100, TimeUnit.MILLISECONDS)
+                .atMost(10, TimeUnit.SECONDS).until(() -> {
+                    final int code = RestAssured.given()
+                            .contentType(ContentType.JSON)
+                            .body(stop)
+                            .post("/telegram/stop-location")
+                            .then()
+                            .extract().statusCode();
+                    return code == 201;
+                });
     }
 
     @Test

Reply via email to