zhuzhurk commented on a change in pull request #9872: 
[FLINK-14291][runtime,tests] Add test coverage to DefaultScheduler
URL: https://github.com/apache/flink/pull/9872#discussion_r333323027
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/DefaultSchedulerTest.java
 ##########
 @@ -252,18 +249,27 @@ public void failJobIfNotEnoughResources() throws 
Exception {
                        findThrowableWithMessage(
                                failureCause,
                                "Could not allocate the required slot within 
slot request timeout.").isPresent());
+               assertThat(jobStatus, is(equalTo(JobStatus.FAILED)));
        }
 
-       private void drainAllAvailableSlots() {
-               final int numberOfAvailableSlots = 
slotProvider.getNumberOfAvailableSlots();
-               for (int i = 0; i < numberOfAvailableSlots; i++) {
-                       slotProvider.allocateSlot(
-                               new SlotRequestId(),
-                               new ScheduledUnit(new JobVertexID(), null, 
null),
-                               SlotProfile.noRequirements(),
-                               true,
-                               Time.milliseconds(TIMEOUT_MS));
-               }
+       @Test
+       public void skipDeploymentIfVertexVersionOutdated() {
+               final JobGraph jobGraph = singleNonParallelJobVertexJobGraph();
+
+               final DefaultScheduler scheduler = 
createSchedulerAndStartScheduling(jobGraph);
+
+               final List<ExecutionVertexID> initiallyScheduledVertices = 
testExecutionVertexOperations.getDeployedVertices();
+
+               final ArchivedExecutionVertex onlyExecutionVertex = 
Iterables.getOnlyElement(scheduler.requestJob().getAllExecutionVertices());
+               final ExecutionAttemptID attemptId = 
onlyExecutionVertex.getCurrentExecutionAttempt().getAttemptId();
+               scheduler.updateTaskExecutionState(new 
TaskExecutionState(jobGraph.getJobID(), attemptId, ExecutionState.FAILED));
+
+               testExecutionSlotAllocator.disableAutoCompletePendingRequests();
+               taskRestartExecutor.triggerScheduledTasks();
+               executionVertexVersioner.recordModification(new 
ExecutionVertexID(getOnlyJobVertex(jobGraph).getID(), 0));
 
 Review comment:
   To verify that concurrent failovers are working fine, I think it's better to 
let the DefaultScheduler do the `recordModification` in `restartTasksWithDelay` 
rather than doing it directly in the test. 
   This may require a task failure to be triggered. The failure should affect 
task X and happen when task X is in a certain stage, including (waiting for 
assigning resource), (resource is assigned but waiting for other tasks to 
finish resource assignment to do `deployAll`).

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