@Test
  public void testPropertyStoreCleanUpTaskAllInstancesUp() throws IOException {
    TestUtils.ZkInfo zkInfo =
        new TestUtils.ZkInfo(TestUtils.getTempDir(PropertyStoreCleanUpTask.COMMAND), DC, (byte) 1, ZK_PORT + '3', true);
    ClusterMapConfig clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(getProperties()));
    HelixManager helixManager = new MockHelixManager(ClusterMapUtils.getInstanceName(HOST_NAME, PORT),
        InstanceType.PARTICIPANT, ZK_HOST + ":" + zkInfo.getPort(), CLUSTER_NAME, new MockHelixAdmin(),
        null, null, null, false);
    DataNodeConfigSource dataNodeConfigSource = new PropertyStoreToDataNodeConfigAdapter(
        ZK_HOST + ":" + zkInfo.getPort(), clusterMapConfig);

    testCluster3(helixManager, dataNodeConfigSource);

    // Run the task
    PropertyStoreCleanUpTask propertyStoreCleanUpTask =
        new PropertyStoreCleanUpTask(helixManager, dataNodeConfigSource, clusterMapConfig, metricRegistry);
    TaskResult taskResult = propertyStoreCleanUpTask.run();

    //Task should be completed successfully
    assertEquals(TaskResult.Status.COMPLETED, taskResult.getStatus());

    //Replica should be present in property store for all hosts -> localhost_1, localhost_2, localhost_3
    assertTrue(dataNodeConfigSource.get(ClusterMapUtils.getInstanceName("localhost_1", PORT))
        .getDiskConfigs().get("disk1").getReplicaConfigs().containsKey("partition1"));
    assertTrue(dataNodeConfigSource.get(ClusterMapUtils.getInstanceName("localhost_1", PORT))
        .getDiskConfigs().get("disk2").getReplicaConfigs().containsKey("partition2"));

    assertTrue(dataNodeConfigSource.get(ClusterMapUtils.getInstanceName("localhost_2", PORT))
        .getDiskConfigs().get("disk1").getReplicaConfigs().containsKey("partition1"));
    assertTrue(dataNodeConfigSource.get(ClusterMapUtils.getInstanceName("localhost_2", PORT))
        .getDiskConfigs().get("disk2").getReplicaConfigs().containsKey("partition2"));

    assertTrue(dataNodeConfigSource.get(ClusterMapUtils.getInstanceName("localhost_3", PORT))
        .getDiskConfigs().get("disk1").getReplicaConfigs().containsKey("partition1"));
    assertTrue(dataNodeConfigSource.get(ClusterMapUtils.getInstanceName("localhost_3", PORT))
        .getDiskConfigs().get("disk2").getReplicaConfigs().containsKey("partition2"));
  }
Test the case when no instance is down and all instances are present in ideal state or external view
Replicas should not be removed from property store
ambry-clustermap/src/test/java/com/github/ambry/clustermap/PropertyStoreCleanUpTaskTest.java