Skip to content

Commit 61d1f67

Browse files
committed
[FLINK-26596][runtime][test] Adds leadership loss handling
If the ZK connection is flaky, we might collect another ZK connection loss. This is now handled properly.
1 parent e981675 commit 61d1f67

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

flink-runtime/src/test/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalConnectionHandlingTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,10 @@ public void testNewLeaderAfterReconnectTriggersListenerNotification() throws Exc
287287
// check that we find the new leader information eventually
288288
CommonTestUtils.waitUntilCondition(
289289
() -> {
290-
final CompletableFuture<String> afterConnectionReconnect =
291-
queueLeaderElectionListener.next();
292-
return afterConnectionReconnect.get().equals(newLeaderAddress);
290+
final String afterConnectionReconnect =
291+
queueLeaderElectionListener.next().get();
292+
return afterConnectionReconnect != null
293+
&& afterConnectionReconnect.equals(newLeaderAddress);
293294
},
294295
Deadline.fromNow(Duration.ofSeconds(30L)));
295296
});

0 commit comments

Comments
 (0)