gaoyunhaii commented on a change in pull request #15055: URL: https://github.com/apache/flink/pull/15055#discussion_r662779190
########## File path: flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java ########## @@ -1729,43 +1731,117 @@ protected void cancelTask() { } @Test - public void testTriggeringCheckpointWithFinishedChannels() throws Exception { - AtomicReference<Future<?>> lastCheckpointTriggerFuture = new AtomicReference<>(); + public void testNotWaitingForAllRecordsProcessedIfCheckpointNotEnabled() throws Exception { + ResultPartitionWriter[] partitionWriters = new ResultPartitionWriter[2]; + try { + for (int i = 0; i < partitionWriters.length; ++i) { + partitionWriters[i] = + PartitionTestUtils.createPartition(ResultPartitionType.PIPELINED_BOUNDED); + partitionWriters[i].setup(); + } - try (StreamTaskMailboxTestHarness<String> testHarness = - new StreamTaskMailboxTestHarnessBuilder<>( - env -> - new HoldingOnAfterInvokeStreamTask( - env, lastCheckpointTriggerFuture), - BasicTypeInfo.STRING_TYPE_INFO) - .addInput(BasicTypeInfo.STRING_TYPE_INFO, 3) - .setupOutputForSingletonOperatorChain(new EmptyOperator()) - .build()) { - // Tests triggering checkpoint when all the inputs are alive. - Future<Boolean> checkpointFuture = triggerCheckpoint(testHarness, 2); - processMailTillCheckpointSucceeds(testHarness, checkpointFuture); - assertEquals(2, testHarness.getTaskStateManager().getReportedCheckpointId()); + try (StreamTaskMailboxTestHarness<String> testHarness = + new StreamTaskMailboxTestHarnessBuilder<>( + OneInputStreamTask::new, STRING_TYPE_INFO) + .modifyStreamConfig(config -> config.setCheckpointingEnabled(false)) + .addInput(STRING_TYPE_INFO) + .setupOperatorChain(new EmptyOperator()) + .setNumberOfNonChainedOutputs(1 + partitionWriters.length) + .finishForSingletonOperatorChain(StringSerializer.INSTANCE) + .addAdditionalOutput(partitionWriters) Review comment: Very thanks for the review, I also agree with that separate `setNumberOfNonChainedOutputs` and `addAdditionalOutput` might cause inconsistency, I'll enforce `addAdditionalOutput` get called before `setupOperatorChain` and move the count to the `StreamConfigChainer`'s constructor -- 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...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org