This is an automated email from the ASF dual-hosted git repository.

jiajunwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 6a957b9  Fix TestClusterAccessor. (#1657)
6a957b9 is described below

commit 6a957b9530631a3e4e93d21e1efdaa465e191e09
Author: Jiajun Wang <[email protected]>
AuthorDate: Fri Feb 26 15:24:16 2021 -0800

    Fix TestClusterAccessor. (#1657)
    
    The test fails due to a previous change that we used WAGED as the default 
super cluster resource rebalancer. This PR will fix the test logic so it is 
still compatible with the new change.
---
 .../apache/helix/rest/server/TestClusterAccessor.java   | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git 
a/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java
 
b/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java
index f73738f..d88c4af 100644
--- 
a/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java
+++ 
b/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java
@@ -669,12 +669,16 @@ public class TestClusterAccessor extends 
AbstractTestClass {
     final HelixDataAccessor normalAccessor = new 
ZKHelixDataAccessor(ACTIVATE_NORM_CLUSTER, _baseAccessor);
     final PropertyKey.Builder normKeyBuilder = normalAccessor.keyBuilder();
 
-    boolean result = TestHelper.verify(new TestHelper.Verifier() {
-      @Override
-      public boolean verify() {
-        LiveInstance leader = 
normalAccessor.getProperty(normKeyBuilder.controllerLeader());
-        return leader != null;
+    boolean result = TestHelper.verify(() -> {
+      LiveInstance leader = 
normalAccessor.getProperty(normKeyBuilder.controllerLeader());
+      if (leader == null) {
+        // TODO: Remove the following logic once 
https://github.com/apache/helix/issues/1617 is fixed.
+        // TODO: For now, we may need to touch the IdealState to trigger a new 
rebalance since the test
+        // TODO: is running multiple GenericHelixController instances in one 
JVM.
+        IdealState is = 
normalAccessor.getProperty(keyBuilder.idealStates(ACTIVATE_NORM_CLUSTER));
+        
normalAccessor.setProperty(keyBuilder.idealStates(ACTIVATE_NORM_CLUSTER), is);
       }
+      return leader != null;
     }, 12000);
     Assert.assertTrue(result);
 
@@ -685,8 +689,7 @@ public class TestClusterAccessor extends AbstractTestClass {
 
     IdealState idealState = 
accessor.getProperty(keyBuilder.idealStates(ACTIVATE_NORM_CLUSTER));
     Assert.assertEquals(idealState.getRebalanceMode(), 
IdealState.RebalanceMode.FULL_AUTO);
-    Assert.assertEquals(idealState.getRebalancerClassName(), 
DelayedAutoRebalancer.class.getName());
-    Assert.assertEquals(idealState.getRebalanceStrategy(), 
CrushEdRebalanceStrategy.class.getName());
+    Assert.assertEquals(idealState.getRebalancerClassName(), 
WagedRebalancer.class.getName());
     // Note, set expected replicas value to 3, as the same value of 
DEFAULT_SUPERCLUSTER_REPLICA in ClusterAccessor.
     Assert.assertEquals(idealState.getReplicas(), "3");
 

Reply via email to