You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/06/06 08:57:35 UTC

[GitHub] [flink] zhijiangW commented on a change in pull request #8630: [FLINK-12667][runtime] Add JobID to TaskExecutorGateway#releasePartitions

zhijiangW 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_r291083575
 
 

 ##########
 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:
   Maybe we could provide an utility for creating `SimpleSlot` in this class, because it would be reused for many tests.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services