This is an automated email from the ASF dual-hosted git repository.

mapohl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 61d1f67c11f245d96f82e78c25f78ed2ca603919
Author: Matthias Pohl <[email protected]>
AuthorDate: Fri Mar 11 18:14:34 2022 +0100

    [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.
---
 .../ZooKeeperLeaderRetrievalConnectionHandlingTest.java            | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/flink-runtime/src/test/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalConnectionHandlingTest.java
 
b/flink-runtime/src/test/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalConnectionHandlingTest.java
index f2c12a7..f385df4 100644
--- 
a/flink-runtime/src/test/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalConnectionHandlingTest.java
+++ 
b/flink-runtime/src/test/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalConnectionHandlingTest.java
@@ -287,9 +287,10 @@ class ZooKeeperLeaderRetrievalConnectionHandlingTest {
                     // check that we find the new leader information eventually
                     CommonTestUtils.waitUntilCondition(
                             () -> {
-                                final CompletableFuture<String> 
afterConnectionReconnect =
-                                        queueLeaderElectionListener.next();
-                                return 
afterConnectionReconnect.get().equals(newLeaderAddress);
+                                final String afterConnectionReconnect =
+                                        
queueLeaderElectionListener.next().get();
+                                return afterConnectionReconnect != null
+                                        && 
afterConnectionReconnect.equals(newLeaderAddress);
                             },
                             Deadline.fromNow(Duration.ofSeconds(30L)));
                 });

Reply via email to