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


##########
flink-runtime/src/test/java/org/apache/flink/runtime/leaderelection/DefaultLeaderElectionServiceTest.java:
##########
@@ -311,8 +312,11 @@ void testMultipleDriverCreations() throws Exception {
     @Test
     void testGrantCallWhileInstantiatingDriver() throws Exception {
         final UUID expectedLeaderSessionID = UUID.randomUUID();
+        // leadership acquired right from the start
         final TestingLeaderElectionDriver.Builder driverBuilder =
-                TestingLeaderElectionDriver.newNoOpBuilder();
+                TestingLeaderElectionDriver.newBuilder(new 
AtomicBoolean(true));

Review Comment:
   That was an interesting one because I wondered why we didn't need to set the 
leadership pre-FLINK-36451.
   
   The reason was a bug in the 
[TestingLeaderContender#grantLeadership](https://github.com/apache/flink/pull/25679/files#diff-b0f861e1a8e93374d482f4565c05430b9134f10bf691da391abef6b79b4dd015L53)
 method. The old implementation confirmed the leadership and pushed a 
LeaderInformation event after that call even if the confirmation failed (due to 
leadership loss). The new implementation is cleaner in this regards



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