This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push: new c97fd57887 Poll telegram stop-location endpoint to avoid sporadic failures c97fd57887 is described below commit c97fd578872d9de7e4b3872c4b08f56fe40611b2 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