@Test
  public void testCreateAndUpdateCluster() throws Exception {
    String destZkHostName = "localhost";
    int destZkServerPort = SRC_ZK_SERVER_PORT + 1;
    String destZkConnectString = destZkHostName + ":" + destZkServerPort;
    String destVcrClusterName = "DEST_VCR_CLUSTER1";
    // set up dest zk
    TestUtils.ZkInfo destZkInfo =
        new com.github.ambry.utils.TestUtils.ZkInfo(TestUtils.getTempDir("helixDestVcr"), "DC1", (byte) 1,
            destZkServerPort, true);
    HelixVcrUtil.createCluster(destZkConnectString, destVcrClusterName, config);

    HelixVcrUtil.updateResourceAndPartition(SRC_ZK_CONNECT_STRING, SRC_CLUSTER_NAME, destZkConnectString,
        destVcrClusterName, config, false);
    Assert.assertTrue("Dest and Src should be same",
        isSrcDestSync(SRC_ZK_CONNECT_STRING, SRC_CLUSTER_NAME, destZkConnectString, destVcrClusterName));

    // add one more partition to src cluster resource 1 and add one more resource to src cluster
    srcHelixAdmin.dropResource(SRC_CLUSTER_NAME, "1");
    String[] resourceNames = {"1", "2"};
    Set<String> partitionSet = new HashSet<>();
    for (int i = 0; i < 101; i++) {
      partitionSet.add(Integer.toString(i));
    }
    for (String resourceName : resourceNames) {
      IdealState idealState =
          HelixVcrUtil.buildIdealState(resourceName, partitionSet, config.getIdealStateConfigFields());
      srcHelixAdmin.addResource(SRC_CLUSTER_NAME, resourceName, idealState);
    }

    HelixVcrUtil.updateResourceAndPartition(SRC_ZK_CONNECT_STRING, SRC_CLUSTER_NAME, destZkConnectString,
        destVcrClusterName, config, false);
    Assert.assertTrue("Dest and Src should be same",
        isSrcDestSync(SRC_ZK_CONNECT_STRING, SRC_CLUSTER_NAME, destZkConnectString, destVcrClusterName));

    // Test the update-only option as well, make sure partitions are unchanged
    HelixVcrUtil.updateResourceIdealState(destZkConnectString, destVcrClusterName, config, false);
    Assert.assertTrue("Dest and Src should be same",
        isSrcDestSync(SRC_ZK_CONNECT_STRING, SRC_CLUSTER_NAME, destZkConnectString, destVcrClusterName));

    destZkInfo.shutdown();
  }
Test {@link HelixVcrUtil#createCluster(String, String, HelixVcrUtil.VcrHelixConfig)} and
{@link HelixVcrUtil#updateResourceAndPartition(String, String, String, String, HelixVcrUtil.VcrHelixConfig, boolean)} method.
ambry-tools/src/integration-test/java/com/github/ambry/clustermap/HelixVcrPopulateToolTest.java