You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2023/09/04 12:05:12 UTC

[james-project] 12/13: JAMES-3926 Demonstrate delete issue on Cassandra counters in other places

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 05a04d5b8f71e9390528d6305b4315d5ca5cc2a1
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Fri Aug 25 12:11:07 2023 +0700

    JAMES-3926 Demonstrate delete issue on Cassandra counters in other places
---
 .../cassandra/quota/CassandraQuotaCurrentValueDaoTest.java    |  2 +-
 .../cassandra/mail/CassandraMailboxCounterDAOTest.java        | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/quota/CassandraQuotaCurrentValueDaoTest.java b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/quota/CassandraQuotaCurrentValueDaoTest.java
index a4995855ac..baa6eea80b 100644
--- a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/quota/CassandraQuotaCurrentValueDaoTest.java
+++ b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/quota/CassandraQuotaCurrentValueDaoTest.java
@@ -100,7 +100,7 @@ public class CassandraQuotaCurrentValueDaoTest {
         assertThat(cassandraQuotaCurrentValueDao.getQuotaCurrentValue(quotaKey).block()).isNull();
     }
 
-    @Disabled("Cassandra counter deletion is reversed once counter is incremented")
+    @Disabled("Cassandra counter deletion is reversed once counter is incremented cf http://wiki.apache.org/cassandra/Counters")
     @Test
     void deleteQuotaCurrentValueShouldResetCounterForever() {
         cassandraQuotaCurrentValueDao.increase(QUOTA_KEY, 100L).block();
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxCounterDAOTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxCounterDAOTest.java
index cf83c2f5cc..1b13262bae 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxCounterDAOTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxCounterDAOTest.java
@@ -32,6 +32,7 @@ import org.apache.james.mailbox.model.MailboxCounters;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.UidValidity;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
@@ -74,6 +75,16 @@ class CassandraMailboxCounterDAOTest {
         assertThat(testee.countMessagesInMailbox(mailbox).block()).isEqualTo(1L);
     }
 
+    @Disabled("Cassandra counter deletion is reversed once counter is incremented cf http://wiki.apache.org/cassandra/Counters")
+    @Test
+    void deleteShouldResetCounterValueForever() {
+        testee.incrementCount(MAILBOX_ID).block();
+        testee.delete(MAILBOX_ID).block();
+        testee.incrementCount(MAILBOX_ID).block();
+
+        assertThat(testee.countMessagesInMailbox(mailbox).block()).isEqualTo(1L);
+    }
+
     @Test
     void incrementUnseenAndCountShouldAddOneWhenAbsent() {
         testee.incrementUnseenAndCount(MAILBOX_ID).block();


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