@Test
  public void diskCapacityUpdateTest() throws Exception {
    // create a HelixClusterManager with DynamicClusterChangeHandler
    Properties properties = new Properties();
    properties.putAll(props);
    ClusterMapConfig clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(properties));
    HelixClusterManager helixClusterManager =
        new HelixClusterManager(clusterMapConfig, selfInstanceName, helixManagerFactory, new MetricRegistry());
    // disk capacity after initialization should equal to original value (100L * 1024 * 1024 * 1024)
    PartitionId partitionId = helixClusterManager.getAllPartitionIds(null).get(0);
    assertEquals("Mismatch in disk capacity", 100L * 1024 * 1024 * 1024,
        partitionId.getReplicaIds().get(0).getDiskId().getRawCapacityInBytes());
    // update disk capacity
    testHardwareLayout.updateDiskCapacity(500L * 1024 * 1024 * 1024);
    Utils.writeJsonObjectToFile(testHardwareLayout.getHardwareLayout().toJSONObject(), hardwareLayoutPath);
    helixCluster.upgradeWithNewHardwareLayout(hardwareLayoutPath);
    partitionId = helixClusterManager.getAllPartitionIds(null).get(0);
    assertEquals("Mismatch in disk capacity", 500L * 1024 * 1024 * 1024,
        partitionId.getReplicaIds().get(0).getDiskId().getRawCapacityInBytes());
    helixClusterManager.close();
  }
Test the case where the disk capacity is updated dynamically.
@throws Exception
ambry-clustermap/src/test/java/com/github/ambry/clustermap/ClusterChangeHandlerTest.java