jiajunwang commented on a change in pull request #1295:
URL: https://github.com/apache/helix/pull/1295#discussion_r488401062



##########
File path: 
zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestRawZkClient.java
##########
@@ -285,18 +285,26 @@ public void testZkClientMonitor()
     Assert.assertTrue(beanServer.isRegistered(idealStatename));
 
     Assert.assertEquals((long) beanServer.getAttribute(name, 
"DataChangeEventCounter"), 0);
-    Assert.assertEquals((long) beanServer.getAttribute(name, 
"StateChangeEventCounter"), 0);
+    Assert.assertEquals((long) beanServer.getAttribute(name, 
"StateChangeEventCounter"), 1);
     Assert.assertEquals((long) beanServer.getAttribute(name, 
"ExpiredSessionCounter"), 0);
     Assert.assertEquals((long) beanServer.getAttribute(name, 
"OutstandingRequestGauge"), 0);
     // account for doAsyncSync()
     Assert.assertEquals((long) beanServer.getAttribute(name, 
"TotalCallbackCounter"), 1);
 
-    // Test exists
-    Assert.assertEquals((long) beanServer.getAttribute(rootname, 
"ReadCounter"), 0);
-    Assert.assertEquals((long) beanServer.getAttribute(rootname, 
"ReadTotalLatencyCounter"), 0);
-    Assert.assertEquals((long) beanServer.getAttribute(rootname, 
"ReadLatencyGauge.Max"), 0);
-    zkClient.exists(TEST_ROOT);
+    // Note, we need to wait here for the reason that doAsyncSync() blocks 
only the zkClient event thread. The main
+    // thread of zkClient would issue exits(TEST_ROOT) without blocking. The 
return of doAsyncSync() would be asyc
+    // to main thread. doAsyncSync() is a source of 1 read and main thread 
exists(TEST_ROOT) would be another.
+    TestHelper.verify(()->{
+      return 
((org.apache.helix.zookeeper.zkclient.ZkClient)zkClient).getSyncStatus();
+    }, TestHelper.WAIT_DURATION);
+
     Assert.assertEquals((long) beanServer.getAttribute(rootname, 
"ReadCounter"), 1);
+    //Assert.assertEquals((long) beanServer.getAttribute(rootname, 
"ReadTotalLatencyCounter"), 1);

Review comment:
       Let's sync up tomorrow. I didn't get why waiting for the read count = 2 
won't work.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to