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


##########
flink-runtime/src/test/java/org/apache/flink/runtime/leaderelection/DefaultLeaderElectionServiceTest.java:
##########
@@ -349,22 +380,42 @@ void 
testProperCleanupOnLeaderElectionCloseWhenHoldingTheLeadership() throws Exc
                             final UUID leaderSessionID = UUID.randomUUID();
                             grantLeadership(leaderSessionID);
 
-                            
assertThat(testingContender.getLeaderSessionID()).isNotNull();
-                            
assertThat(leaderElectionService.getLeaderSessionID(contenderID))
-                                    .isEqualTo(leaderSessionID);
-                            
assertThat(storedLeaderInformation.get().forContenderID(contenderID))
-                                    
.hasValue(LeaderInformation.known(leaderSessionID, TEST_URL));
+                            applyToBothContenderContexts(
+                                    ctx -> {
+                                        
assertThat(ctx.contender.getLeaderSessionID())
+                                                .isEqualTo(leaderSessionID);
+                                        assertThat(
+                                                        
leaderElectionService.getLeaderSessionID(
+                                                                
ctx.contenderID))
+                                                .isEqualTo(leaderSessionID);
+
+                                        assertThat(
+                                                        
leaderElectionService.getLeaderSessionID(
+                                                                
ctx.contenderID))
+                                                .isEqualTo(leaderSessionID);
+
+                                        assertThat(
+                                                        storedLeaderInformation
+                                                                .get()
+                                                                
.forContenderID(ctx.contenderID))
+                                                .hasValue(
+                                                        
LeaderInformation.known(
+                                                                
leaderSessionID, ctx.address));

Review Comment:
   yeah, I tried to reduce it already by providing the context members in the 
callback function instead of the context struct itself. That way, we would 
avoid having `ctx.` in the code. But it' doesn't help as much as I hoped.



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