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

trohrmann pushed a commit to branch release-1.11
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.11 by this push:
     new c3992df  [FLINK-21550][tests] Harden 
ZooKeeperHaServicesTest.testSimpleClose
c3992df is described below

commit c3992df220b3fc7b0623ff3cae130b230c2804c9
Author: Till Rohrmann <[email protected]>
AuthorDate: Mon Mar 22 22:20:47 2021 +0100

    [FLINK-21550][tests] Harden ZooKeeperHaServicesTest.testSimpleClose
    
    This commit hardens the ZooKeeperHaServicesTest by not busy loop waiting 
with a timeout
    on a leader election but instead to use 
LeaderRetrievalUtils.LeaderConnectionInfoListener
    which offers a future which is completed when the leader is elected.
    
    This closes #15334.
---
 .../highavailability/zookeeper/ZooKeeperHaServicesTest.java        | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/flink-runtime/src/test/java/org/apache/flink/runtime/highavailability/zookeeper/ZooKeeperHaServicesTest.java
 
b/flink-runtime/src/test/java/org/apache/flink/runtime/highavailability/zookeeper/ZooKeeperHaServicesTest.java
index b459e9c..81dc6b4 100644
--- 
a/flink-runtime/src/test/java/org/apache/flink/runtime/highavailability/zookeeper/ZooKeeperHaServicesTest.java
+++ 
b/flink-runtime/src/test/java/org/apache/flink/runtime/highavailability/zookeeper/ZooKeeperHaServicesTest.java
@@ -27,8 +27,8 @@ import org.apache.flink.runtime.concurrent.Executors;
 import org.apache.flink.runtime.highavailability.RunningJobsRegistry;
 import org.apache.flink.runtime.leaderelection.LeaderElectionService;
 import org.apache.flink.runtime.leaderelection.TestingContender;
-import org.apache.flink.runtime.leaderelection.TestingListener;
 import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService;
+import org.apache.flink.runtime.util.LeaderRetrievalUtils;
 import org.apache.flink.runtime.util.ZooKeeperUtils;
 import org.apache.flink.runtime.zookeeper.ZooKeeperResource;
 import org.apache.flink.util.TestLogger;
@@ -185,14 +185,15 @@ public class ZooKeeperHaServicesTest extends TestLogger {
             final RunningJobsRegistry runningJobsRegistry =
                     zooKeeperHaServices.getRunningJobsRegistry();
 
-            final TestingListener listener = new TestingListener();
+            final LeaderRetrievalUtils.LeaderConnectionInfoListener listener =
+                    new LeaderRetrievalUtils.LeaderConnectionInfoListener();
             resourceManagerLeaderRetriever.start(listener);
             resourceManagerLeaderElectionService.start(
                     new TestingContender("foobar", 
resourceManagerLeaderElectionService));
             final JobID jobId = new JobID();
             runningJobsRegistry.setJobRunning(jobId);
 
-            listener.waitForNewLeader(2000L);
+            listener.getLeaderConnectionInfoFuture().join();
 
             resourceManagerLeaderRetriever.stop();
             resourceManagerLeaderElectionService.stop();

Reply via email to