@Test
  public void testAggregateHostAccountStorageStatsWithOutdatedNode() throws Exception {
    Map<Long, Map<Short, Map<Short, ContainerStorageStats>>> upToDateStorageStatsMap = new HashMap<>();
    upToDateStorageStatsMap.put((long) 0,
        StorageStatsUtilTest.generateRandomAggregatedAccountStorageStats((short) 0, 5, 3, 10000L, 2, 10));
    Map<Long, Map<Short, Map<Short, ContainerStorageStats>>> outdatedStorageStatsMap = new HashMap<>();
    outdatedStorageStatsMap.put((long) 0,
        StorageStatsUtilTest.generateRandomAggregatedAccountStorageStats((short) 0, 6, 3, 10000L, 2, 10));

    StatsHeader header = new StatsHeader(StatsHeader.StatsDescription.STORED_DATA_SIZE,
        TimeUnit.MINUTES.toMillis(2 * RELEVANT_PERIOD_IN_MINUTES), 1, 1, Collections.emptyList());
    HostAccountStorageStatsWrapper upToDateNodeStats =
        new HostAccountStorageStatsWrapper(header, new HostAccountStorageStats(upToDateStorageStatsMap));
    header = new StatsHeader(StatsHeader.StatsDescription.STORED_DATA_SIZE, 0, 1, 1, Collections.emptyList());
    HostAccountStorageStatsWrapper outdatedNodeStats =
        new HostAccountStorageStatsWrapper(header, new HostAccountStorageStats(outdatedStorageStatsMap));
    header = new StatsHeader(StatsHeader.StatsDescription.STORED_DATA_SIZE,
        TimeUnit.MINUTES.toMillis(2 * RELEVANT_PERIOD_IN_MINUTES), 0, 0, Collections.emptyList());
    HostAccountStorageStatsWrapper emptyNodeStats =
        new HostAccountStorageStatsWrapper(header, new HostAccountStorageStats());

    Map<String, HostAccountStorageStatsWrapper> instanceToStatsMap = new LinkedHashMap<>();
    instanceToStatsMap.put("Instance_0", upToDateNodeStats);
    instanceToStatsMap.put("Instance_1", outdatedNodeStats);
    instanceToStatsMap.put("Instance_2", emptyNodeStats);

    Map<Short, Map<Short, ContainerStorageStats>> expectedValid =
        clusterAggregator.aggregateHostAccountStorageStats(upToDateStorageStatsMap);
    ClusterMapConfig clusterMapConfig = getClusterMapConfig();
    InmemoryAccountStatsStore accountStatsStore = new InmemoryAccountStatsStore(
        "unused_clustername", "unused_hostname", instanceToStatsMap, null);
    Pair<AggregatedAccountStorageStats, AggregatedAccountStorageStats> aggregatedRawAndValidStats =
        clusterAggregator.aggregateHostAccountStorageStatsWrappers(new AccountStorageStatsIterator(
            instanceToStatsMap.keySet().stream().collect(Collectors.toList()), accountStatsStore, clusterMapConfig));
    Assert.assertEquals(expectedValid, aggregatedRawAndValidStats.getSecond().getStorageStats());
  }
Test {@link MySqlClusterAggregator#aggregateHostAccountStorageStatsWrappers} but with one node having outdated
storage stats data. Outdated data shouldn't be used when aggregating valid storage usage.
@throws Exception
ambry-clustermap/src/test/java/com/github/ambry/clustermap/MySqlClusterAggregatorTest.java