You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2024/04/09 03:25:35 UTC

(james-project) branch master updated: JAMES-2586 Fix flaky tests in EmailQueryMethodTest

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


The following commit(s) were added to refs/heads/master by this push:
     new 0eec6dc386 JAMES-2586 Fix flaky tests in EmailQueryMethodTest
0eec6dc386 is described below

commit 0eec6dc386cab8417468455c4ecd5f0e29c02f22
Author: hung phan <hp...@linagora.com>
AuthorDate: Fri Apr 5 11:05:57 2024 +0700

    JAMES-2586 Fix flaky tests in EmailQueryMethodTest
---
 .../contract/EmailQueryMethodContract.scala        | 40 ++++++++++++----------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
index 8924bed4d9..3bec025475 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
+++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
@@ -2997,7 +2997,7 @@ trait EmailQueryMethodContract {
 
     val message1: Message = Message.Builder
       .of
-      .setTo("aaa@domain.tld")
+      .setTo("\"aaa\" <aa...@domain.tld>")
       .setSubject("subject")
       .setBody("any body", StandardCharsets.UTF_8)
       .build
@@ -3008,7 +3008,7 @@ trait EmailQueryMethodContract {
 
     val message2: Message = Message.Builder
       .of
-      .setTo("ccc@domain.tld")
+      .setTo("\"ccc\" <cc...@domain.tld>")
       .setSubject("subject")
       .setBody("any body", StandardCharsets.UTF_8)
       .build
@@ -3019,7 +3019,7 @@ trait EmailQueryMethodContract {
 
     val message3: Message = Message.Builder
       .of
-      .setTo("aba@domain.tld")
+      .setTo("\"aba\" <ab...@domain.tld>")
       .setSubject("subject")
       .setBody("any body", StandardCharsets.UTF_8)
       .build
@@ -3067,7 +3067,7 @@ trait EmailQueryMethodContract {
 
     val message1: Message = Message.Builder
       .of
-      .setFrom("aaa@domain.tld")
+      .setFrom("\"aaa\" <aa...@domain.tld>")
       .setSubject("subject")
       .setBody("any body", StandardCharsets.UTF_8)
       .build
@@ -3078,7 +3078,7 @@ trait EmailQueryMethodContract {
 
     val message2: Message = Message.Builder
       .of
-      .setFrom("ccc@domain.tld")
+      .setFrom("\"ccc\" <cc...@domain.tld>")
       .setSubject("subject")
       .setBody("any body", StandardCharsets.UTF_8)
       .build
@@ -3089,7 +3089,7 @@ trait EmailQueryMethodContract {
 
     val message3: Message = Message.Builder
       .of
-      .setFrom("aba@domain.tld")
+      .setFrom("\"aba\" <ab...@domain.tld>")
       .setSubject("subject")
       .setBody("any body", StandardCharsets.UTF_8)
       .build
@@ -7175,22 +7175,24 @@ trait EmailQueryMethodContract {
          |    "c1"]]
          |}""".stripMargin
 
-    val response = `given`
-      .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER)
-      .body(request)
+    awaitAtMostTenSeconds.untilAsserted { () =>
+      val response = `given`
+        .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER)
+        .body(request)
       .when
-      .post
+        .post
       .`then`
-      .statusCode(SC_OK)
-      .contentType(JSON)
-      .extract
-      .body
-      .asString
+        .statusCode(SC_OK)
+        .contentType(JSON)
+        .extract
+        .body
+        .asString
 
-    assertThatJson(response)
-      .withOptions(new Options(IGNORING_ARRAY_ORDER))
-      .inPath("$.methodResponses[0][1].ids")
-      .isEqualTo(s"""["${messageId.serialize}"]""")
+      assertThatJson(response)
+        .withOptions(new Options(IGNORING_ARRAY_ORDER))
+        .inPath("$.methodResponses[0][1].ids")
+        .isEqualTo(s"""["${messageId.serialize}"]""")
+    }
   }
 
   @Test


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