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_r333339025
########## 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)); + testExecutionSlotAllocator.completePendingRequests(); + + assertThat(initiallyScheduledVertices, is(equalTo(testExecutionVertexOperations.getDeployedVertices()))); Review comment: One more thing we may need to verify is that concurrent failovers should not result in more failovers. We can do it by limit the max restart attempts or check the final attempt number of a vertex. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services