azagrebin commented on a change in pull request #8778: [FLINK-12615][coordination] Track partitions on JM URL: https://github.com/apache/flink/pull/8778#discussion_r295723910
########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionTest.java ########## @@ -588,6 +588,68 @@ public void testEagerSchedulingFailureReturnsSlot() throws Exception { assertThat(returnedSlotFuture.get(), is(equalTo(slotRequestIdFuture.get()))); } + @Test + public void testPartitionTrackedWhenFinished() throws Exception { + testPartitionTrackingForStateTransition(Execution::markFinished, true); + } + + @Test + public void testPartitionNotTrackedWhenCanceled() throws Exception { + testPartitionTrackingForStateTransition(Execution::cancel, false); + } + + @Test + public void testPartitionNotTrackedWhenFailed() throws Exception { + testPartitionTrackingForStateTransition(execution -> execution.fail(new Exception()), false); + } + + private void testPartitionTrackingForStateTransition(final Consumer<Execution> stateTransition, final boolean shouldPartitionBeTracked) throws Exception { + final JobVertex producerVertex = createNoOpJobVertex(); + final JobVertex consumerVertex = createNoOpJobVertex(); + consumerVertex.connectNewDataSetAsInput(producerVertex, DistributionPattern.ALL_TO_ALL, ResultPartitionType.BLOCKING); + + final TaskManagerLocation taskManagerLocation = new LocalTaskManagerLocation(); + + final SimpleSlot slot = new SimpleSlot( + new SingleSlotTestingSlotOwner(), + taskManagerLocation, + 0, + new SimpleAckingTaskManagerGateway()); + + final ProgrammedSlotProvider slotProvider = new ProgrammedSlotProvider(1); + slotProvider.addSlot(producerVertex.getID(), 0, CompletableFuture.completedFuture(slot)); + + ExecutionGraph executionGraph = ExecutionGraphTestUtils.createSimpleTestGraph( Review comment: nit: inconsistent use of `final` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services