315157973 commented on a change in pull request #11062:
URL: https://github.com/apache/pulsar/pull/11062#discussion_r657665348



##########
File path: 
pulsar-metadata/src/test/java/org/apache/pulsar/metadata/ZKSessionTest.java
##########
@@ -171,10 +168,12 @@ public void testReacquireLeadershipAfterSessionLost() 
throws Exception {
         e = sessionEvents.poll(10, TimeUnit.SECONDS);
         assertEquals(e, SessionEvent.SessionLost);
 
-        Awaitility.await().untilAsserted(() -> {
-            assertEquals(le1.getState(), LeaderElectionState.Leading);
-        });
-
+        // due to zookeeper async notice, we need to wait.
+        Awaitility.await()
+                .until(() -> le1.getState() == LeaderElectionState.Leading);
+        assertEquals(le1.getState(), LeaderElectionState.Leading);
+        Awaitility.await()
+                .until(()-> leaderElectionEvents.poll() == null);

Review comment:
       I have one more question:
   Why is leaderElectionEvents not null here? 
   Even if it is changed to peek, it seems that it cannot be explained




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to