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 bt...@apache.org on 2019/10/16 02:23:11 UTC

[james-project] 02/02: JAMES-2704 Random storing can leave some mailboxes empty

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

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

commit b42a7da85dc1bcbed00d6e43c26b577aa8d4bfee
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Oct 15 13:18:29 2019 +0700

    JAMES-2704 Random storing can leave some mailboxes empty
    
    This mailet assigns emails between 4 to 8 mailboxes. However, there is no
    coordination, hence some mailboxes can be left empty.
    
    This do not plays well with the cache on routing info in that mailet: some
    auto provisionned inboxes or not yet created mailboxes might get ignored.
    
    Furthermore, that assertion was hidden 3 method call deep the callstack, violating the rule
    "one assertion per test, explicit and at the end on the main testing method".
    
    As such it deserves to be removed.
    
    Note: the main assertion "given 100 mail, we will assign and store it between
    400 and 800 times" still stands.
---
 .../test/java/org/apache/james/smtp/SmtpRandomStoringTest.java   | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
index b3d45e5..f9acef7 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
@@ -29,6 +29,7 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.stream.IntStream;
 import java.util.stream.LongStream;
+
 import javax.mail.MessagingException;
 
 import org.apache.james.MemoryJamesServerMain;
@@ -51,7 +52,6 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.IMAPMessageReader;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.mailet.Mail;
-
 import org.awaitility.Duration;
 import org.awaitility.core.ConditionFactory;
 import org.junit.After;
@@ -186,13 +186,8 @@ public class SmtpRandomStoringTest {
 
     private Long numberOfMessagesInMailbox(IMAPMessageReader imapMessageReader, String mailbox) {
         try {
-            long numberOfMails = imapMessageReader
+            return imapMessageReader
                 .getMessageCount(mailbox);
-
-            assertThat(numberOfMails)
-                .isGreaterThan(0);
-
-            return numberOfMails;
         } catch (IOException e) {
             throw new RuntimeException(e);
         }


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