chenjunjiedada commented on code in PR #4943:
URL: https://github.com/apache/iceberg/pull/4943#discussion_r894066521


##########
flink/v1.15/flink/src/test/java/org/apache/iceberg/flink/source/TestStreamingMonitorFunction.java:
##########
@@ -208,6 +211,81 @@ public void testCheckpointRestore() throws Exception {
     }
   }
 
+  @Test
+  public void testInvalidMaxSnapshotCountPerMonitorInterval() {
+    final ScanContext scanContext1 = ScanContext.builder()
+        .monitorInterval(Duration.ofMillis(100))
+        .maxSnapshotCountPerMonitorInterval(0)
+        .build();
+
+    AssertHelpers.assertThrows("Should throw exception because of invalid 
config",
+        IllegalArgumentException.class, "must be greater than zero",
+        () -> {
+          createFunction(scanContext1);
+          return null;
+        }
+    );
+
+    final ScanContext scanContext2 = ScanContext.builder()
+        .monitorInterval(Duration.ofMillis(100))
+        .maxSnapshotCountPerMonitorInterval(-10)
+        .build();
+
+    AssertHelpers.assertThrows("Should throw exception because of invalid 
config",
+        IllegalArgumentException.class, "must be greater than zero",
+        () -> {
+          createFunction(scanContext2);
+          return null;
+        }
+    );
+  }
+
+  @Test
+  public void testConsumeWithMaxSnapshotCountPerMonitorInterval() throws 
Exception {
+    generateRecordsAndCommitTxn(10);
+
+    // Use the oldest snapshot as starting to avoid the initial case.
+    long oldestSnapshotId = SnapshotUtil.oldestAncestor(table).snapshotId();
+
+    ScanContext scanContext3 = ScanContext.builder()

Review Comment:
   Not necessary actually, updated.



-- 
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...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to