zhangmeng916 commented on a change in pull request #1449:
URL: https://github.com/apache/helix/pull/1449#discussion_r501244706



##########
File path: 
helix-core/src/test/java/org/apache/helix/controller/changedetector/TestResourceChangeDetector.java
##########
@@ -438,7 +441,7 @@ public void testResetSnapshots() {
     Assert.assertEquals(
         changeDetector.getAdditionsByType(ChangeType.IDEAL_STATE).size() + 
changeDetector
             .getChangesByType(ChangeType.IDEAL_STATE).size() + changeDetector
-            .getRemovalsByType(ChangeType.IDEAL_STATE).size(), 2);
+            .getRemovalsByType(ChangeType.IDEAL_STATE).size(), 1);

Review comment:
       Does this number change mean what we previously tested was wrong? How to 
justify?

##########
File path: 
helix-core/src/test/java/org/apache/helix/integration/TestDisableCustomCodeRunner.java
##########
@@ -209,9 +214,7 @@ public void test() throws Exception {
 
     // Re-enable custom-code runner
     admin.enableResource(clusterName, customCodeRunnerResource, true);
-    result = ClusterStateVerifier.verifyByZkCallback(
-        new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR, 
clusterName));
-    Assert.assertTrue(result);
+    Assert.assertTrue(verifier.verifyByPolling());

Review comment:
       Just want to make sure, besides waiting for some time before verifying, 
the verify by polling function is same as what previous is done?

##########
File path: 
helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestSemiAutoRebalance.java
##########
@@ -92,33 +95,11 @@ public void beforeClass() throws InterruptedException {
     _controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, 
controllerName);
     _controller.syncStart();
 
-    Thread.sleep(1000);
-
-    // verify ideal state and external view
-    IdealState idealState = 
_accessor.getProperty(_keyBuilder.idealStates(DB_NAME));
-    Assert.assertNotNull(idealState);
-    Assert.assertEquals(idealState.getNumPartitions(), PARTITION_NUMBER);
-    for (String partition : idealState.getPartitionSet()) {
-      List<String> preferenceList = idealState.getPreferenceList(partition);
-      Assert.assertNotNull(preferenceList);
-      Assert.assertEquals(preferenceList.size(), REPLICA_NUMBER);
-    }
-
-    ExternalView externalView = 
_accessor.getProperty(_keyBuilder.externalView(DB_NAME));
-    Assert.assertNotNull(externalView);
-    Assert.assertEquals(externalView.getPartitionSet().size(), 
PARTITION_NUMBER);
-    for (String partition : externalView.getPartitionSet()) {
-      Map<String, String> stateMap = externalView.getStateMap(partition);
-      Assert.assertEquals(stateMap.size(), REPLICA_NUMBER);
-
-      int masters = 0;
-      for (String state : stateMap.values()) {
-        if (state.equals(MasterSlaveSMD.States.MASTER.name())) {
-          ++masters;
-        }
-      }
-      Assert.assertEquals(masters, 1);
-    }
+    ZkHelixClusterVerifier verifier = new 
BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME)

Review comment:
       Is previous verification moved to somewhere else?

##########
File path: 
helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java
##########
@@ -111,10 +111,14 @@ public void testEnableCompressionResource() throws 
Exception {
     }
 
     BestPossibleExternalViewVerifier verifier =
-        new 
BestPossibleExternalViewVerifier.Builder(clusterName).setZkAddr(ZK_ADDR)
-            
.setExpectLiveInstances(expectedLiveInstances).setResources(expectedResources).build();
-    boolean result = verifier.verify(120000L);
-    Assert.assertTrue(result);
+        new 
BestPossibleExternalViewVerifier.Builder(clusterName).setZkClient(_gZkClient)
+            
.setExpectLiveInstances(expectedLiveInstances).setResources(expectedResources)
+            
.setWaitTillVerify(TestHelper.DEFAULT_REBALANCE_PROCESSING_WAIT_TIME)
+            .build();
+
+    System.out.println("before TestEnableCompression verify by polling");

Review comment:
       Remove this line.

##########
File path: 
helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java
##########
@@ -111,10 +111,14 @@ public void testEnableCompressionResource() throws 
Exception {
     }
 
     BestPossibleExternalViewVerifier verifier =
-        new 
BestPossibleExternalViewVerifier.Builder(clusterName).setZkAddr(ZK_ADDR)
-            
.setExpectLiveInstances(expectedLiveInstances).setResources(expectedResources).build();
-    boolean result = verifier.verify(120000L);
-    Assert.assertTrue(result);
+        new 
BestPossibleExternalViewVerifier.Builder(clusterName).setZkClient(_gZkClient)
+            
.setExpectLiveInstances(expectedLiveInstances).setResources(expectedResources)
+            
.setWaitTillVerify(TestHelper.DEFAULT_REBALANCE_PROCESSING_WAIT_TIME)
+            .build();
+
+    System.out.println("before TestEnableCompression verify by polling");
+    boolean reuslt = verifier.verifyByPolling(20 * 60 * 1000, 2000);

Review comment:
       Can we define the number somewhere instead of using a math expression?

##########
File path: 
helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalance.java
##########
@@ -164,9 +169,19 @@ public void testAutoRebalance() throws Exception {
     // kill 1 node
     _participants[0].syncStop();
 
-    boolean result = ClusterStateVerifier
-        .verifyByZkCallback(new ExternalViewBalancedVerifier(_gZkClient, 
CLUSTER_NAME, TEST_DB));
-    Assert.assertTrue(result);
+    ZkHelixClusterVerifier verifierTestDb = new 
BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME)
+        .setResources(new HashSet<>(Collections.singleton(TEST_DB)))
+        .setZkClient(_gZkClient)
+        .setWaitTillVerify(TestHelper.DEFAULT_REBALANCE_PROCESSING_WAIT_TIME)
+        .build();
+    Assert.assertTrue(verifierTestDb.verifyByPolling());
+
+    ZkHelixClusterVerifier verifierDb2 = new 
BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME)

Review comment:
       Please change Db2 to a better name.




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