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

reschke pushed a commit to branch OAK-10181
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit e13de86fb7767feaac0766b063817afedcc6ad50
Author: Julian Reschke <resc...@apache.org>
AuthorDate: Wed Aug 2 08:15:14 2023 +0100

    OAK-10181: Flaky test: DataStoreBlobStoreStatsTest - ensure that the two 
created blobs are different
---
 .../oak/plugins/blob/datastore/DataStoreBlobStoreStatsTest.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStoreStatsTest.java
 
b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStoreStatsTest.java
index f4b5473d27..f27005994b 100644
--- 
a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStoreStatsTest.java
+++ 
b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStoreStatsTest.java
@@ -21,6 +21,7 @@ package org.apache.jackrabbit.oak.plugins.blob.datastore;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
@@ -79,6 +80,8 @@ public class DataStoreBlobStoreStatsTest {
         String blobId1 = dsbs.writeBlob(getTestInputStream());
         String blobId2 = dsbs.writeBlob(getTestInputStream());
 
+        assertNotEquals(blobId1, blobId2);
+
         long downloadCount = stats.getDownloadCount();
         long downloadCountLastMinute = 
getLastMinuteStats(stats.getDownloadCountHistory());
         long downloadTotalSize = stats.getDownloadTotalSize();
@@ -938,8 +941,11 @@ public class DataStoreBlobStoreStatsTest {
                         stats, 1L, 0L).longValue());
     }
 
-
     private InputStream getTestInputStream() {
+        long was = System.currentTimeMillis();
+        while (was == System.currentTimeMillis()) {
+            // OAK-10181: wait for system time to move, otherwise we might use 
the same seed twice
+        }
         return new RandomInputStream(System.currentTimeMillis(), BLOB_LEN);
     }
 

Reply via email to