TisonKun commented on a change in pull request #7303: [FLINK-10569] [tests] Get 
rid of Scheduler from valid tests
URL: https://github.com/apache/flink/pull/7303#discussion_r248454800
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionGraphRestartTest.java
 ##########
 @@ -155,21 +153,12 @@ public void testRestartAutomatically() throws Exception {
        public void testCancelWhileRestarting() throws Exception {
                // We want to manually control the restart and delay
                RestartStrategy restartStrategy = new 
InfiniteDelayRestartStrategy();
-               Tuple2<ExecutionGraph, Instance> executionGraphInstanceTuple = 
createExecutionGraph(restartStrategy);
-               ExecutionGraph executionGraph = executionGraphInstanceTuple.f0;
-               Instance instance = executionGraphInstanceTuple.f1;
 
-               // Kill the instance and wait for the job to restart
-               instance.markDead();
-
-               Deadline deadline = TestingUtils.TESTING_DURATION().fromNow();
-
-               while (deadline.hasTimeLeft() &&
-                               executionGraph.getState() != 
JobStatus.RESTARTING) {
-
-                       Thread.sleep(100);
-               }
+               SlotProvider slotProvider = new TestingSlotProvider(ignore -> 
new CompletableFuture<>());
+               ExecutionGraph executionGraph = 
createSimpleExecutionGraph(restartStrategy, slotProvider);
+               assertEquals(JobStatus.CREATED, executionGraph.getState());
 
+               executionGraph.scheduleForExecution();
                assertEquals(JobStatus.RESTARTING, executionGraph.getState());
 
 Review comment:
   This is because the SlotProvider returns non-completed future. And eg is 
configured as not allow queued scheduling. Thus when scheduleForExecutor, it 
causes `IllegalArgumentException("The slot allocation future has not been 
completed yet.")` and then failing and then restarting.
   
   But it is tricky. Maybe I should set allow queued scheduling and fail a 
future to emulate a real failure.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to