tillrohrmann commented on a change in pull request #8227: [FLINK-12180][Tests] 
Port ExecutionVertexCancelTest to new codebase
URL: https://github.com/apache/flink/pull/8227#discussion_r278885656
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionVertexCancelTest.java
 ##########
 @@ -360,8 +361,23 @@ public void testActionsWhileCancelling() {
                                ExecutionVertex vertex = new 
ExecutionVertex(ejv, 0, new IntermediateResult[0],
                                                AkkaUtils.getDefaultTimeout());
 
-                               Instance instance = getInstance(new 
ActorTaskManagerGateway(DummyActorGateway.INSTANCE));
-                               SimpleSlot slot = instance.allocateSimpleSlot();
+                               final TestingSlotOwner slotOwner = new 
TestingSlotOwner();
+                               final TaskManagerLocation taskManagerLocation = 
new LocalTaskManagerLocation();
+                               
slotOwner.setReturnAllocatedSlotConsumer((LogicalSlot logicalSlot) -> {
+                                       try {
+                                               Method m = 
Slot.class.getDeclaredMethod("markReleased");
+                                               m.setAccessible(true);
+                                               m.invoke(logicalSlot);
+                                       }
+                                       catch (Exception e) {
+                                               throw new 
RuntimeException("Calling the method failed", e);
+                                       }
+                               });
+                               final SimpleSlot slot = new SimpleSlot(
+                                       slotOwner,
+                                       taskManagerLocation,
+                                       0,
+                                       new SimpleAckingTaskManagerGateway());
 
 Review comment:
   use the `TestingSlot` 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