azagrebin commented on a change in pull request #7565: [FLINK-11400] Linearize
leadership operations in JobManagerRunner
URL: https://github.com/apache/flink/pull/7565#discussion_r251369589
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/JobManagerRunnerTest.java
##########
@@ -204,11 +211,52 @@ public void testLibraryCacheManagerRegistration() throws
Exception {
}
}
+ /**
+ * Tests that the {@link JobManagerRunner} always waits for the
previous leadership operation
+ * (granting or revoking leadership) to finish before starting a new
leadership operation.
+ */
+ @Test
+ public void testConcurrentLeadershipOperations() throws Exception {
+ final CompletableFuture<Acknowledge> suspendedFuture = new
CompletableFuture<>();
+
+ TestingJobMasterServiceFactory jobMasterServiceFactory = new
TestingJobMasterServiceFactory(
+ () -> new TestingJobMasterService(
+ "localhost",
+ e -> suspendedFuture));
+ JobManagerRunner jobManagerRunner =
createJobManagerRunner(jobMasterServiceFactory);
+
+ jobManagerRunner.start();
+
+ leaderElectionService.isLeader(UUID.randomUUID()).get();
+
+ leaderElectionService.notLeader();
Review comment:
do we also want to test `isLeader` against `jobMasterService.start` future
in the similar way?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services