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 2020/04/24 02:59:36 UTC

[james-project] 01/17: JAMES-3135 increase TTL in DumbBlobStoreCache tests to make the tests non flacky

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 5549455f305b80f9fa5956fe911e6e59840a9dc4
Author: RĂ©mi KOWALSKI <rk...@linagora.com>
AuthorDate: Thu Apr 23 10:32:31 2020 +0200

    JAMES-3135 increase TTL in DumbBlobStoreCache tests to make the tests non flacky
---
 .../james/blob/cassandra/cache/CassandraDumbBlobStoreCacheTest.java   | 4 ++--
 .../apache/james/blob/cassandra/cache/DumbBlobStoreCacheContract.java | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/cache/CassandraDumbBlobStoreCacheTest.java b/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/cache/CassandraDumbBlobStoreCacheTest.java
index 4658a01..5b88799 100644
--- a/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/cache/CassandraDumbBlobStoreCacheTest.java
+++ b/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/cache/CassandraDumbBlobStoreCacheTest.java
@@ -34,7 +34,7 @@ public class CassandraDumbBlobStoreCacheTest implements DumbBlobStoreCacheContra
 
     private final Duration DEFAULT_READ_TIMEOUT = Duration.ofSeconds(50);
     private final int DEFAULT_THRESHOLD_IN_BYTES = EIGHT_KILOBYTES.length;
-    private final Duration _1_SEC_TTL = Duration.ofSeconds(1);
+    private final Duration _2_SEC_TTL = Duration.ofSeconds(2);
 
     private DumbBlobStoreCache testee;
     private HashBlobId.Factory blobIdFactory;
@@ -45,7 +45,7 @@ public class CassandraDumbBlobStoreCacheTest implements DumbBlobStoreCacheContra
         CassandraCacheConfiguration cacheConfiguration = new CassandraCacheConfiguration.Builder()
             .sizeThresholdInBytes(DEFAULT_THRESHOLD_IN_BYTES)
             .timeOut(DEFAULT_READ_TIMEOUT)
-            .ttl(_1_SEC_TTL)
+            .ttl(_2_SEC_TTL)
             .build();
         testee = new CassandraDumbBlobStoreCache(cassandra.getConf(), cacheConfiguration);
     }
diff --git a/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/cache/DumbBlobStoreCacheContract.java b/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/cache/DumbBlobStoreCacheContract.java
index a9cef55..e4101f6 100644
--- a/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/cache/DumbBlobStoreCacheContract.java
+++ b/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/cache/DumbBlobStoreCacheContract.java
@@ -104,8 +104,8 @@ public interface DumbBlobStoreCacheContract {
         BlobId blobId = blobIdFactory().randomId();
         assertThatCode(Mono.from(testee().cache(blobId, EIGHT_KILOBYTES))::block)
             .doesNotThrowAnyException();
-
-        await().atMost(Duration.TWO_SECONDS).await().untilAsserted(()
+        //add some time after the TTL to avoid threshold effect
+        await().atMost(Duration.TWO_SECONDS.plus(Duration.FIVE_HUNDRED_MILLISECONDS)).await().untilAsserted(()
             -> assertThat(Mono.from(testee().read(blobId)).blockOptional()).isEmpty());
     }
 }


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