xyuanlu commented on code in PR #2623:
URL: https://github.com/apache/helix/pull/2623#discussion_r1346423232


##########
meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestZkMetaClientCache.java:
##########
@@ -48,31 +50,62 @@ public void testCacheDataUpdates() {
             zkMetaClientCache.connect();
             zkMetaClientCache.create(key, "test");
             zkMetaClientCache.create(key + DATA_PATH, DATA_VALUE);
-
             // Get data for DATA_PATH and cache it
             String data = zkMetaClientCache.get(key + DATA_PATH);
             Assert.assertEquals(data, 
zkMetaClientCache.getDataCacheMap().get(key + DATA_PATH));
 
             // Update data for DATA_PATH
             String newData = zkMetaClientCache.update(key + DATA_PATH, 
currentData -> currentData + "1");
 
-            // Verify that cached data is updated. Might take some time
-            for (int i = 0; i < 10; i++) {
-                if (zkMetaClientCache.getDataCacheMap().get(key + 
DATA_PATH).equals(newData)) {
-                    break;
-                }
-                Thread.sleep(1000);
-            }
+            // Verify that cached data is updated. Might take some time. 
Shouldn't take more than 5 seconds.
+            Thread.sleep(5000);
             Assert.assertEquals(newData, 
zkMetaClientCache.getDataCacheMap().get(key + DATA_PATH));
 
             zkMetaClientCache.delete(key + DATA_PATH);
+
             // Verify that cached data is updated. Might take some time
-            for (int i = 0; i < 10; i++) {
-                if (zkMetaClientCache.getDataCacheMap().get(key + DATA_PATH) 
== null) {
-                    break;
-                }
-                Thread.sleep(1000);
-            }
+            Thread.sleep(5000);

Review Comment:
   nit: you can use verifier
   ` TestHelper.verify(() -> {
               return !zkMetaClientCache.getDataCacheMap().get(key + DATA_PATH);
             }
           }
           return true;
         }, 30000);`



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

To unsubscribe, e-mail: [email protected]

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