tillrohrmann commented on a change in pull request #8988:
[FLINK-12736][coordination] Release TaskExecutor in SlotManager if no slot
allocations after partition check
URL: https://github.com/apache/flink/pull/8988#discussion_r300599477
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManagerTest.java
##########
@@ -742,14 +741,31 @@ public void testTaskManagerNotReleasedBeforeItCanBe()
throws Exception {
mainThreadExecutor.execute(() ->
slotManager.registerTaskManager(taskManagerConnection, slotReport));
// now it can not be released yet
- canBeReleased.set(false);
-
mainThreadExecutor.execute(slotManager::checkTaskManagerTimeouts);
+ canBeReleased.set(new CompletableFuture<>());
+
mainThreadExecutor.execute(slotManager::checkTaskManagerTimeouts); // trigger
TM.canBeReleased request
mainThreadExecutor.triggerAll();
- assertFalse(releaseFuture.isDone());
+ canBeReleased.get().complete(false);
+ mainThreadExecutor.triggerAll();
+ assertThat(releaseFuture.isDone(), is(false));
+
+ // Allocate and free slot between triggering
TM.canBeReleased request and receiving response.
+ // There can be potentially newly unreleased
partitions, therefore TM can not be released yet.
+ canBeReleased.set(new CompletableFuture<>());
+
mainThreadExecutor.execute(slotManager::checkTaskManagerTimeouts); // trigger
TM.canBeReleased request
+ mainThreadExecutor.triggerAll();
+ AllocationID allocationID = new AllocationID();
+ slotManager.registerSlotRequest(new SlotRequest(new
JobID(), allocationID, resourceProfile, "foobar"));
+ mainThreadExecutor.triggerAll();
+ slotManager.freeSlot(slotId, allocationID);
+ canBeReleased.get().complete(true);
+ mainThreadExecutor.triggerAll();
+ assertThat(releaseFuture.isDone(), is(false));
Review comment:
I think this should become a separate test case as tests should only test a
single thing.
----------------------------------------------------------------
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