You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/09/26 21:41:23 UTC

[GitHub] [helix] kaisun2000 commented on issue #1418: Fix TestSemiAutoRebalance.beforeClass

kaisun2000 commented on issue #1418:
URL: https://github.com/apache/helix/issues/1418#issuecomment-699551282


   code
   ```
      // start controller
       String controllerName = CONTROLLER_PREFIX + "_0";
       _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);
       }
   
   ```


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org