danzhewuju commented on code in PR #29460:
URL: https://github.com/apache/flink/pull/29460#discussion_r4255143675


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/job/rescales/JobRescaleDetailsHandlerTest.java:
##########
@@ -160,6 +163,80 @@ void testRequestNormalJobRescaleStatisticsDetails()
         assertThat(jobRescaleDetails).isEqualTo(fromRescale(rescale, true));
     }
 
+    @Test
+    void testRequestLatestRescaleEvictedFromHistory()
+            throws HandlerRequestException, RestHandlerException {
+        final Rescale latestIgnoredRescale =
+                
createTerminatedRescale(TerminatedReason.RESOURCE_REQUIREMENTS_UPDATED);
+        final Rescale retainedCompletedRescale =
+                createTerminatedRescale(TerminatedReason.SUCCEEDED);
+        final ExecutionGraphInfo executionGraphInfo =
+                createExecutionGraphInfo(latestIgnoredRescale, 
retainedCompletedRescale);
+        final HandlerRequest<EmptyRequestBody> request =
+                createRequest(
+                        executionGraphInfo.getJobId(),
+                        
latestIgnoredRescale.getRescaleIdInfo().getRescaleUuid());
+
+        assertThat(testInstance.handleRequest(request, executionGraphInfo))
+                .isEqualTo(fromRescale(latestIgnoredRescale, true));
+    }
+
+    @Test
+    void testArchiveIncludesLatestRescaleEvictedFromHistory() throws 
IOException {
+        final Rescale latestIgnoredRescale =
+                
createTerminatedRescale(TerminatedReason.RESOURCE_REQUIREMENTS_UPDATED);
+        final Rescale retainedCompletedRescale =
+                createTerminatedRescale(TerminatedReason.SUCCEEDED);
+        final ExecutionGraphInfo executionGraphInfo =
+                createExecutionGraphInfo(latestIgnoredRescale, 
retainedCompletedRescale);
+
+        final Collection<ArchivedJson> archives =
+                testInstance.archiveJsonWithPath(executionGraphInfo);
+
+        assertThat(archives)
+                .extracting(ArchivedJson::getPath)
+                .containsExactlyInAnyOrder(
+                        getDetailsPath(executionGraphInfo, 
latestIgnoredRescale),
+                        getDetailsPath(executionGraphInfo, 
retainedCompletedRescale));
+    }
+
+    private static ExecutionGraphInfo createExecutionGraphInfo(
+            Rescale latestIgnoredRescale, Rescale retainedCompletedRescale) {
+        final RescalesSummary rescalesSummary = new RescalesSummary(1);
+        rescalesSummary.addTerminated(latestIgnoredRescale);
+        rescalesSummary.addTerminated(retainedCompletedRescale);
+        return new ExecutionGraphInfo(
+                new ArchivedExecutionGraphBuilder().build(),
+                List.of(),
+                null,
+                null,
+                new RescalesStatsSnapshot(
+                        List.of(retainedCompletedRescale),

Review Comment:
   Good catch. I added a failed rescale that is present only in the history. 
The tests now verify both direct lookup of this history-only rescale and its 
inclusion in the archived JSON. The completed rescale remains present in both 
collections to exercise deduplication.



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