mxm commented on code in PR #26640:
URL: https://github.com/apache/flink/pull/26640#discussion_r2149877045


##########
flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/state/rocksdb/RocksDBStateUploaderTest.java:
##########
@@ -233,6 +238,32 @@ void testMultiThreadUploadCorrectly() throws Exception {
         }
     }
 
+    @Test
+    void testApplyJitter() throws Exception {
+        try (RocksDBStateUploader rocksDBStateUploader =
+                new RocksDBStateUploader(1, Duration.ofMillis(1000L))) {
+            rocksDBStateUploader.applyJitter(
+                    sleepTime -> {
+                        assertThat(sleepTime).isGreaterThan(0);
+                        assertThat(sleepTime).isLessThanOrEqualTo(1000);
+                    });
+
+            long startTime = System.currentTimeMillis();
+            rocksDBStateUploader.applyJitter(new 
RocksDBStateUploader.JitterConsumer());
+            assertThat(System.currentTimeMillis()).isGreaterThan(startTime);

Review Comment:
   This could become flaky in some cases, e.g. when there is just a single 
millisecond wait. The precision is not guaranteed. We could get the same result 
for `System.currentTimeMillis()`. Not sure if it is worth to keep this 
assertion. 



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to