danny0405 commented on code in PR #9896:
URL: https://github.com/apache/hudi/pull/9896#discussion_r1367622937


##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/sink/utils/TestWriteBase.java:
##########
@@ -305,6 +305,34 @@ public TestHarness checkpointComplete(long checkpointId) {
       return this;
     }
 
+    /**
+     * Flush data using endInput. Asserts the commit would fail.
+     */
+    public void commitAsBatchThrows(Class<?> cause, String msg) {
+      // this triggers the data write and event send
+      this.pipeline.endInput();
+      final OperatorEvent nextEvent = this.pipeline.getNextEvent();
+      this.pipeline.getCoordinator().handleEventFromOperator(0, nextEvent);
+      assertTrue(this.pipeline.getCoordinatorContext().isJobFailed(), "Job 
should have been failed");
+      Throwable throwable = 
this.pipeline.getCoordinatorContext().getJobFailureReason().getCause();
+      assertThat(throwable, instanceOf(cause));
+      assertThat(throwable.getMessage(), containsString(msg));
+    }
+
+    /**
+     * Flush data using endInput. Asserts the commit would fail.
+     */
+    public TestHarness commitAsBatch() {
+      // this triggers the data write and event send
+      this.pipeline.endInput();
+      final OperatorEvent nextEvent = this.pipeline.getNextEvent();
+      this.pipeline.getCoordinator().handleEventFromOperator(0, nextEvent);
+      if (this.pipeline.getCoordinatorContext().isJobFailed()) {
+        
System.err.println(this.pipeline.getCoordinatorContext().getJobFailureReason().getCause());

Review Comment:
   We do not print in test.



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

Reply via email to