XComp commented on code in PR #24237:
URL: https://github.com/apache/flink/pull/24237#discussion_r1472551337


##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/ExecutingTest.java:
##########
@@ -634,17 +628,23 @@ public ExecutingStateBuilder setLastRescale(Instant 
lastRescale) {
         private Executing build(MockExecutingContext ctx) {
             executionGraph.transitionToRunning();
 
-            return new Executing(
-                    executionGraph,
-                    getExecutionGraphHandler(executionGraph, 
ctx.getMainThreadExecutor()),
-                    operatorCoordinatorHandler,
-                    log,
-                    ctx,
-                    ClassLoader.getSystemClassLoader(),
-                    new ArrayList<>(),
-                    scalingIntervalMin,
-                    scalingIntervalMax,
-                    lastRescale);
+            try {
+                return new Executing(
+                        executionGraph,
+                        getExecutionGraphHandler(executionGraph, 
ctx.getMainThreadExecutor()),
+                        operatorCoordinatorHandler,
+                        log,
+                        ctx,
+                        ClassLoader.getSystemClassLoader(),
+                        new ArrayList<>(),
+                        scalingIntervalMin,
+                        scalingIntervalMax,
+                        lastRescale);
+            } finally {
+                Preconditions.checkState(

Review Comment:
   This change makes sense. We don't have any tests that cover this for the 
issue that's resolved in this PR, though (reverting the change in `Executing` 
won't cause any failures). We might want to add another test like that one:
   ```java
       @Test
       public void
               
testNotifyNewResourcesAvailableWithCanScaleUpWithoutForceWhileTransitioningIntoExecutingState()
                       throws Exception {
           try (MockExecutingContext ctx = new MockExecutingContext()) {
               final ExecutingStateBuilder executingStateBuilder =
                       new ExecutingStateBuilder()
                               .setScalingIntervalMin(Duration.ofSeconds(20L))
                               .setScalingIntervalMax(Duration.ofSeconds(30L))
                               
.setLastRescale(Instant.now().minus(Duration.ofSeconds(25L)));
   
               // slots become available while transitioning into Executing 
state
               ctx.setCanScaleUp(true);
   
               final Executing exec = executingStateBuilder.build(ctx);
   
               ctx.setExpectRestarting(
                       restartingArguments ->
                               assertThat(
                                       "Rescaling should be triggered 
immediately after transitioning into Executing state.",
                                       restartingArguments.getBackoffTime(),
                                       is(Duration.ZERO)));
               exec.onNewResourcesAvailable();
           }
       }
   ```



##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/ExecutingTest.java:
##########
@@ -273,7 +274,6 @@ public void 
testNotifyNewResourcesAvailableBeforeCooldownIsOverScheduledStateCha
             ctx.setExpectRestarting(
                     restartingArguments -> {
                         assertThat(restartingArguments.getBackoffTime(), 
is(Duration.ZERO));
-                        assertThat(ctx.actionWasScheduled, is(true));
                     });

Review Comment:
   ```java
   ctx.setExpectRestarting(
                       restartingArguments ->
                               assertThat(restartingArguments.getBackoffTime(), 
is(Duration.ZERO)));
   ```
   nit: for all these removals, the brackets of the lambda expression become 
obsolete. But I guess, it's ok to keep the brackets for readability purposes. 
:thinking: 



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to