Guosmilesmile commented on code in PR #17251:
URL: https://github.com/apache/iceberg/pull/17251#discussion_r3595143710
##########
flink/v2.1/flink/src/test/java/org/apache/iceberg/flink/sink/TestIcebergCommitter.java:
##########
@@ -1156,6 +1159,54 @@ public void testDeleteFiles() throws Exception {
}
}
+ @TestTemplate
+ public void testCommitterOnSubtaskZeroLoadsTable() throws Exception {
+ TableLoader spyLoader = spy(tableLoader);
+ IcebergFilesCommitterMetrics metric =
mock(IcebergFilesCommitterMetrics.class);
+ IcebergCommitter committer =
+ new IcebergCommitter(
+ spyLoader, branch, Collections.emptyMap(), false, 10, "sinkId",
metric, false, 0);
+
+ verify(spyLoader).open();
+ verify(spyLoader).loadTable();
+
+ committer.close();
+ }
+
+ @TestTemplate
+ public void testCommitterOnNonZeroSubtaskSkipsTableLoad() throws Exception {
+ TableLoader spyLoader = spy(tableLoader);
+ IcebergFilesCommitterMetrics metric =
mock(IcebergFilesCommitterMetrics.class);
+ IcebergCommitter committer =
+ new IcebergCommitter(
+ spyLoader, branch, Collections.emptyMap(), false, 10, "sinkId",
metric, false, 1);
+
+ verify(spyLoader, never()).open();
+ verify(spyLoader, never()).loadTable();
+
+ committer.close();
+ }
Review Comment:
Make sense. Change ut to use TestHarness
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]