@Test
  public void helixInitiatedIdealStateChangeTest() throws Exception {
    assumeTrue(!useComposite && !overrideEnabled && !useAggregatedView);
    HelixClusterManager helixClusterManager = (HelixClusterManager) clusterManager;
    verifyInitialClusterChanges(helixClusterManager, helixCluster, helixDcs);
    String resourceName = "newResource";
    String partitionName = String.valueOf(helixCluster.getAllPartitions().size());
    IdealState idealState = new IdealState(resourceName);
    idealState.setPreferenceList(partitionName, new ArrayList<>());
    helixCluster.addNewResource(resourceName, idealState, localDc);
    verifyInitialClusterChanges(helixClusterManager, helixCluster, new String[]{localDc});
    // localDc should have one more partition compared with remoteDc
    Map<String, Map<String, Set<String>>> partitionToResource = (helixClusterManager).getPartitionToResourceMapByDC();
    assertEquals("localDc should have one more partition", partitionToResource.get(localDc).size(),
        partitionToResource.get(remoteDc).size() + 1);
    assertTrue(partitionToResource.get(localDc).containsKey(partitionName) && !partitionToResource.get(remoteDc)
        .containsKey(partitionName));
  }
Test helix initiated ideal state change can be correctly handled by {@link HelixClusterManager}.
@throws Exception
ambry-clustermap/src/test/java/com/github/ambry/clustermap/HelixClusterManagerTest.java