zentol commented on a change in pull request #8630: [FLINK-12667][runtime] Add 
JobID to TaskExecutorGateway#releasePartitions
URL: https://github.com/apache/flink/pull/8630#discussion_r292805023
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionTest.java
 ##########
 @@ -293,6 +299,81 @@ public void 
testSlotAllocationCancellationWhenExecutionCancelled() throws Except
                assertThat(canceledSlotRequests, equalTo(slotRequests));
        }
 
+       /**
+        * Tests that the partitions are released in case of a execution 
cancellation after the execution is already finished.
+        */
+       @Test
+       public void testPartitionReleaseOnCancelAfterFinished() throws 
Exception {
+               testPartitionReleaseAfterFinished(Execution::cancel);
+       }
+
+       /**
+        * Tests that the partitions are released in case of a execution 
suspension after the execution is already finished.
+        */
+       @Test
+       public void testPartitionReleaseOnSuspendAfterFinished() throws 
Exception {
+               testPartitionReleaseAfterFinished(Execution::suspend);
+       }
+
+       private void testPartitionReleaseAfterFinished(Consumer<Execution> 
postFinishedExecutionAction) throws Exception {
+               final Tuple2<JobID, Collection<ResultPartitionID>> 
releasedPartitions = Tuple2.of(null, null);
+               final SimpleAckingTaskManagerGateway taskManagerGateway = new 
SimpleAckingTaskManagerGateway();
+               
taskManagerGateway.setReleasePartitionsConsumer(releasedPartitions::setFields);
+
+               final SimpleSlot slot = new SimpleSlot(
 
 Review comment:
   such a utility already exists in #createProgrammedSlotProvider, will update 
the test to use that instead

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to