This is an automated email from the ASF dual-hosted git repository.

MartijnVisser pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new edba4901475 [FLINK-40067][tests] Fix race in 
RescaleTimelineITCase.testRescaleTerminatedByJobFinished
edba4901475 is described below

commit edba4901475bfd0696d4e95f1c9ca049924b7a81
Author: Martijn Visser <[email protected]>
AuthorDate: Fri Jul 3 21:20:20 2026 +0200

    [FLINK-40067][tests] Fix race in 
RescaleTimelineITCase.testRescaleTerminatedByJobFinished
    
    On a loaded machine the cooldown-driven Idling transition terminates the 
in-progress rescale with NO_RESOURCES_OR_PARALLELISMS_CHANGE before the job 
finishes, so goToFinished's later JOB_FINISHED stamp is dropped and the wait 
can never succeed. Widen the fixture cooldown to keep the rescale in-progress 
until the job finishes, mirroring FLINK-39903/FLINK-40010.
    
    Generated-by: Claude Opus 4.8 (1M context)
---
 .../adaptive/timeline/RescaleTimelineITCase.java         | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git 
a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/timeline/RescaleTimelineITCase.java
 
b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/timeline/RescaleTimelineITCase.java
index 96328abf426..e5920f282cb 100644
--- 
a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/timeline/RescaleTimelineITCase.java
+++ 
b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/timeline/RescaleTimelineITCase.java
@@ -269,6 +269,17 @@ class RescaleTimelineITCase {
 
     @TestTemplate
     void testRescaleTerminatedByJobFinished() throws Exception {
+        // This case only asserts on the recorded rescale history; skip the 
disabled-history
+        // parameter before the cluster rebuild below so it does not pay for 
an unused cluster.
+        assumeThat(enabledRescaleHistory(configuration)).isTrue();
+
+        // With the short shared cooldown the DefaultStateTransitionManager 
re-enters Idling on a
+        // wall-clock timer and terminates the in-progress rescale with
+        // NO_RESOURCES_OR_PARALLELISMS_CHANGE before the job finishes; 
goToFinished then finds it
+        // already terminated and its JOB_FINISHED stamp is ignored, so 
waiting cannot win.
+        // Widen the cooldown to keep the rescale in-progress until the job 
finishes.
+        rebuildClusterWithExecutingTimeouts(Duration.ofSeconds(60), 
Duration.ofSeconds(60));
+
         final MiniCluster miniCluster = miniClusterResource.getMiniCluster();
         final JobGraph jobGraph = createBlockingJobGraph(PARALLELISM);
 
@@ -276,8 +287,6 @@ class RescaleTimelineITCase {
 
         waitForVertexParallelismReachedAndJobRunning(jobGraph, JOB_VERTEX_ID, 
PARALLELISM);
 
-        assumeThat(enabledRescaleHistory(configuration)).isTrue();
-
         updateJobResourceRequirements(miniCluster, jobGraph, 1, PARALLELISM * 
2);
 
         // The upper bound (PARALLELISM * 2) exceeds the available slots, so 
this rescale is only
@@ -289,13 +298,14 @@ class RescaleTimelineITCase {
 
         OnceBlockingNoOpInvokable.unblock();
 
+        // Generous budget: on a loaded CI leg the unblock-to-finish window 
can itself exceed 10s.
         waitUntilConditionWithTimeout(
                 () -> {
                     List<Rescale> rescaleHistory = 
getRescaleHistory(miniCluster, jobGraph);
                     return hasRescaleHistoryMetCondition(
                             rescaleHistory, 2, TerminatedReason.JOB_FINISHED);
                 },
-                10000);
+                60000);
     }
 
     @TestTemplate

Reply via email to