kaisun2000 commented on a change in pull request #1450:
URL: https://github.com/apache/helix/pull/1450#discussion_r501310718



##########
File path: helix-core/src/test/java/org/apache/helix/TestListenerCallback.java
##########
@@ -195,19 +205,27 @@ public void testScopedConfigChangeListener() throws 
Exception {
 
     listener.reset();
     _manager.addConfigChangeListener(listener, ConfigScopeProperty.CLUSTER);
-    Assert.assertTrue(listener._configChanged, "Should get initial 
clusterConfig callback invoked");
+    boolean result = TestHelper.verify(()-> {
+      return listener._configChanged;
+    }, TestHelper.WAIT_DURATION);
+    Assert.assertTrue(result,"Should get initial clusterConfig callback 
invoked");
     Assert.assertEquals(listener._configSize, 1, "Cluster Config size should 
be 1");
 
     listener.reset();
     _manager.addConfigChangeListener(listener, ConfigScopeProperty.RESOURCE);
+    result = TestHelper.verify(()-> {

Review comment:
       Good catch. This is actually addressed in 
https://github.com/apache/helix/pull/1447/files. This file change also belongs 
there.
   
   

##########
File path: 
helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestClusterInMaintenanceModeWhenReachingOfflineInstancesLimit.java
##########
@@ -130,18 +130,24 @@ public void testWithDisabledInstancesLimit() throws 
Exception {
       admin.enableInstance(CLUSTER_NAME, instance, false);
     }
 
-    Thread.sleep(500);
-
-    maintenanceSignal = 
_dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance());
-    Assert.assertNull(maintenanceSignal);
+    boolean result = TestHelper.verify(() -> {
+      MaintenanceSignal ms = 
_dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance());
+      return ms == null;
+    }, TestHelper.WAIT_DURATION);
+    Assert.assertTrue(result);
 
     String instance = _participants.get(i).getInstanceName();
     admin.enableInstance(CLUSTER_NAME, instance, false);
 
-    Thread.sleep(500);
-    maintenanceSignal = 
_dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance());
-    Assert.assertNotNull(maintenanceSignal);
-    Assert.assertNotNull(maintenanceSignal.getReason());
+    ZkHelixClusterVerifier clusterVerifier =
+        new 
BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkClient(_gZkClient)
+            .build();
+    Assert.assertTrue(clusterVerifier.verifyByPolling());
+
+    result = TestHelper.verify(() -> {

Review comment:
       Good catch. This is actually addressed in 
https://github.com/apache/helix/pull/1447/files. This file change also belongs 
there.




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