RocMarshal commented on code in PR #21999:
URL: https://github.com/apache/flink/pull/21999#discussion_r1117066514
##########
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java:
##########
@@ -1103,35 +1143,41 @@ private void
testFailToConfirmCheckpointMessage(Consumer<StreamTask<?, ?>> consu
* finished.
*/
@Test
- public void testCheckpointFailueOnClosedOperator() throws Throwable {
+ void testCheckpointFailueOnClosedOperator() throws Exception {
ClosingOperator<Integer> operator = new ClosingOperator<>();
StreamTaskMailboxTestHarnessBuilder<Integer> builder =
new StreamTaskMailboxTestHarnessBuilder<>(
OneInputStreamTask::new,
BasicTypeInfo.INT_TYPE_INFO)
.addInput(BasicTypeInfo.INT_TYPE_INFO);
try (StreamTaskMailboxTestHarness<Integer> harness =
builder.setupOutputForSingletonOperatorChain(operator).build()) {
- // keeps the mailbox from suspending
- harness.setAutoProcess(false);
- harness.processElement(new StreamRecord<>(1));
-
- harness.streamTask.operatorChain.finishOperators(
- harness.streamTask.getActionExecutor(), StopMode.DRAIN);
- harness.streamTask.operatorChain.closeAllOperators();
- assertTrue(ClosingOperator.closed.get());
-
- harness.streamTask.triggerCheckpointOnBarrier(
- new CheckpointMetaData(1, 0),
- CheckpointOptions.forCheckpointWithDefaultLocation(),
- new CheckpointMetricsBuilder());
- } catch (Exception ex) {
- ExceptionUtils.assertThrowableWithMessage(
- ex, "OperatorChain and Task should never be closed at this
point");
+ assertThatThrownBy(
+ () -> {
+ // keeps the mailbox from suspending
+ harness.setAutoProcess(false);
+ harness.processElement(new StreamRecord<>(1));
+
+
harness.streamTask.operatorChain.finishOperators(
+
harness.streamTask.getActionExecutor(), StopMode.DRAIN);
+
harness.streamTask.operatorChain.closeAllOperators();
+
assertThat(ClosingOperator.closed.get()).isTrue();
Review Comment:
Yes, the small scope could help devs to locate the lines with expected
exception. I'd like it.
--
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]