zentol commented on a change in pull request #18542:
URL: https://github.com/apache/flink/pull/18542#discussion_r794295789



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/JobMasterTest.java
##########
@@ -1816,6 +1819,60 @@ public void 
testJobMasterOnlyTerminatesAfterTheSchedulerHasClosed() throws Excep
         jobMasterTerminationFuture.get();
     }
 
+    @Test
+    public void testJobMasterAcceptsExcessSlotsWhenJobIsRestarting() throws 
Exception {
+        configuration.set(RestartStrategyOptions.RESTART_STRATEGY, 
"fixed-delay");
+        configuration.set(
+                RestartStrategyOptions.RESTART_STRATEGY_FIXED_DELAY_DELAY, 
Duration.ofDays(1));
+        final JobMaster jobMaster =
+                new JobMasterBuilder(jobGraph, rpcService)
+                        .withConfiguration(configuration)
+                        .createJobMaster();
+
+        try {
+            jobMaster.start();
+
+            final JobMasterGateway jobMasterGateway =
+                    jobMaster.getSelfGateway(JobMasterGateway.class);
+
+            assertThat(
+                    jobMasterGateway.requestJobStatus(testingTimeout).get(), 
is(JobStatus.RUNNING));
+
+            final LocalUnresolvedTaskManagerLocation 
unresolvedTaskManagerLocation =
+                    new LocalUnresolvedTaskManagerLocation();
+            registerSlotsAtJobMaster(
+                    1,
+                    jobMasterGateway,
+                    jobGraph.getJobID(),
+                    new TestingTaskExecutorGatewayBuilder()
+                            .setAddress("firstTaskManager")
+                            .createTestingTaskExecutorGateway(),
+                    unresolvedTaskManagerLocation);
+
+            jobMasterGateway.disconnectTaskManager(
+                    unresolvedTaskManagerLocation.getResourceID(),
+                    new FlinkException("Test exception."));
+
+            assertThat(
+                    jobMasterGateway.requestJobStatus(testingTimeout).get(),
+                    is(JobStatus.RESTARTING));

Review comment:
       Need to retry this operation because there's no guarantee the jobmaster 
has processed the disconnect yet.




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