You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rc...@apache.org on 2019/12/11 10:29:00 UTC

[james-project] 12/13: JAMES-2666 Fix EventDeadLetters unstable test

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

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit e5b3ce651ab255e6798d51e0e6016dca8269af7e
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Tue Dec 10 10:28:25 2019 +0700

    JAMES-2666 Fix EventDeadLetters unstable test
    
    There is a time window after the listener has been failed to process an
    event and storing that event into deadletter. If webadmin is requested
    during that time window, there is no event returned from the deadletter
    and consequently, IndexOutboundException at `response.get(0)`
---
 .../integration/EventDeadLettersIntegrationTest.java     | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java
index 2927ac3..1550438 100644
--- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java
@@ -24,8 +24,10 @@ import static io.restassured.RestAssured.when;
 import static io.restassured.RestAssured.with;
 import static org.awaitility.Duration.ONE_HUNDRED_MILLISECONDS;
 import static org.awaitility.Duration.ONE_MINUTE;
+import static org.awaitility.Duration.TEN_SECONDS;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
 import static org.hamcrest.Matchers.hasSize;
 
 import java.util.ArrayList;
@@ -189,12 +191,18 @@ public class EventDeadLettersIntegrationTest {
     }
 
     private String retrieveFirstFailedInsertionId() {
-        List<String> response = with()
+        calmlyAwait.atMost(TEN_SECONDS)
+            .untilAsserted(() ->
+                when()
+                    .get(EventDeadLettersRoutes.BASE_PATH + "/groups/" + GROUP_ID)
+                .then()
+                    .body(".", hasSize(1)));
+
+        return (String) with()
             .get(EventDeadLettersRoutes.BASE_PATH + "/groups/" + GROUP_ID)
             .jsonPath()
-            .getList(".");
-
-        return response.get(0);
+            .getList(".")
+            .get(0);
     }
 
     @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org