sijie closed pull request #2598:  [tests] Flaky Test 
ZooKeeperCacheTest#testChildrenCacheZnodeCreatedAfterCache
URL: https://github.com/apache/incubator-pulsar/pull/2598
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/pulsar-zookeeper-utils/src/test/java/org/apache/pulsar/zookeeper/ZookeeperCacheTest.java
 
b/pulsar-zookeeper-utils/src/test/java/org/apache/pulsar/zookeeper/ZookeeperCacheTest.java
index 09c3ea1524..39f23ac59f 100644
--- 
a/pulsar-zookeeper-utils/src/test/java/org/apache/pulsar/zookeeper/ZookeeperCacheTest.java
+++ 
b/pulsar-zookeeper-utils/src/test/java/org/apache/pulsar/zookeeper/ZookeeperCacheTest.java
@@ -209,12 +209,14 @@ void testChildrenCacheZnodeCreatedAfterCache() throws 
Exception {
             Thread.sleep(1);
         }
 
+        final int recvNotifications = notificationCount.get();
+
         assertEquals(cache.get(), new 
TreeSet<String>(Lists.newArrayList("z1")));
         assertEquals(cache.get("/test"), new 
TreeSet<String>(Lists.newArrayList("z1")));
-        assertEquals(notificationCount.get(), 1);
+        assertTrue(recvNotifications == 1 || recvNotifications == 2);
 
         zkClient.delete("/test/z1", -1);
-        while (notificationCount.get() < 2) {
+        while (notificationCount.get() < (recvNotifications + 1)) {
             Thread.sleep(1);
         }
 
@@ -230,7 +232,7 @@ void testChildrenCacheZnodeCreatedAfterCache() throws 
Exception {
             // Ok
         }
 
-        assertEquals(notificationCount.get(), 2);
+        assertEquals(notificationCount.get(), (recvNotifications + 1));
     }
 
     @Test(timeOut = 10000)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

Reply via email to