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


##########
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:
   Nit / non-blocking: As these are in different functions, do they need to be 
named `scanContext1` ... `scanContext3`. They aren't in the same scope are they?
   
   This doesn't need to be changed, but for my own understanding.



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