chibenwa commented on a change in pull request #498:
URL: https://github.com/apache/james-project/pull/498#discussion_r651773911



##########
File path: 
server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueTest.java
##########
@@ -288,6 +292,51 @@ void 
browseAndDequeueShouldCombineWellWhenDifferentSlices() throws Exception {
                 .containsExactly("3-4", "3-5", "5-1", "5-2", "5-3", "5-4", 
"5-5");
         }
 
+        @Test
+        void enqueuedEmailsShouldEventuallyBeCleaned() {
+            ManageableMailQueue mailQueue = getManageableMailQueue();
+            int emailCount = 5;
+
+            clock.setInstant(IN_SLICE_1);
+            enqueueSomeMails(namePatternForSlice(1), emailCount);
+
+            clock.setInstant(IN_SLICE_2);
+            enqueueSomeMails(namePatternForSlice(2), emailCount);
+
+            clock.setInstant(IN_SLICE_3);
+            enqueueSomeMails(namePatternForSlice(3), emailCount);
+
+            clock.setInstant(IN_SLICE_5);
+            enqueueSomeMails(namePatternForSlice(5), emailCount);
+
+            clock.setInstant(IN_SLICE_7);
+            dequeueMails(5);
+            dequeueMails(5);
+            dequeueMails(5);
+            dequeueMails(5);
+
+            // ensure slice 1 was cleaned
+            EnqueuedMailsDAO mailsDAO = new 
EnqueuedMailsDAO(cassandraCluster.getCassandraCluster().getConf(), new 
HashBlobId.Factory());
+            MailQueueName queueName = 
MailQueueName.fromString(mailQueue.getName().asString());
+            Slice slice = 
Slice.of(Instant.parse("2007-12-03T10:15:00.00Z")).allSlicesTill(IN_SLICE_2, 
ONE_HOUR_SLICE_WINDOW).findFirst()

Review comment:
       Not really, the slice need to be the exact instant




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to