noorall commented on code in PR #27091:
URL: https://github.com/apache/flink/pull/27091#discussion_r2471891118


##########
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/JobMasterTest.java:
##########
@@ -1733,24 +1711,47 @@ void testJobFailureWhenTaskExecutorHeartbeatTimeout() 
throws Exception {
         final TestingHeartbeatServices testingHeartbeatService =
                 new TestingHeartbeatServices(heartbeatInterval, 
heartbeatTimeout);
 
-        runJobFailureWhenTaskExecutorTerminatesTest(
-                testingHeartbeatService,
-                (localTaskManagerLocation, jobMasterGateway) ->
-                        testingHeartbeatService.triggerHeartbeatTimeout(
-                                jmResourceId, 
localTaskManagerLocation.getResourceID()),
-                jobEvents);
-        assertThat(
-                        jobEvents.stream()
-                                .filter(
-                                        event ->
-                                                
Events.JobStatusChangeEvent.name()
-                                                        
.equals(event.getName()))
-                                .map(Event::getAttributes)
-                                .map(x -> x.get("newJobStatus")))
-                .containsSubsequence(
-                        JobStatus.RUNNING.toString(),
-                        JobStatus.FAILING.toString(),
-                        JobStatus.FAILED.toString());
+        final SchedulerType schedulerType =
+                runJobFailureWhenTaskExecutorTerminatesTest(
+                        testingHeartbeatService,
+                        (localTaskManagerLocation, jobMasterGateway) ->
+                                
testingHeartbeatService.triggerHeartbeatTimeout(
+                                        jmResourceId, 
localTaskManagerLocation.getResourceID()),
+                        jobEvents);
+
+        assertJobStatusTransitions(schedulerType, jobEvents);
+    }
+
+    /**
+     * Asserts that job status transitions are as expected based on the 
scheduler type.
+     * DefaultScheduler does not emit CREATED state, while AdaptiveScheduler 
and
+     * AdaptiveBatchScheduler do.
+     */
+    private static void assertJobStatusTransitions(
+            SchedulerType schedulerType, List<Event> jobEvents) {
+        final List<String> jobStatusTransitions =
+                jobEvents.stream()
+                        .filter(event -> 
Events.JobStatusChangeEvent.name().equals(event.getName()))
+                        .map(Event::getAttributes)
+                        .map(x -> (String) x.get("newJobStatus"))
+                        .collect(Collectors.toList());
+
+        if (schedulerType == SchedulerType.Default) {

Review Comment:
   I prefer using `if (schedulerType == SchedulerType.Adaptive)` as `Default` 
is a more general scheduler.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to