GJL 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_r333623246
##########
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:
Fixed, I think. Still not a realistic scenario but good enough.
----------------------------------------------------------------
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