@Test
  public void replicaFromBootstrapToStandbySuccessTest() throws Exception {
    generateConfigs(true, false);
    MockDataNodeId localNode = clusterMap.getDataNodes().get(0);
    List<ReplicaId> localReplicas = clusterMap.getReplicaIds(localNode);
    MockClusterParticipant mockHelixParticipant = new MockClusterParticipant();
    StorageManager storageManager =
        createStorageManager(localNode, metricRegistry, Collections.singletonList(mockHelixParticipant));
    storageManager.start();

    // 0. get listeners from Helix participant and verify there is a storageManager listener.
    Map<StateModelListenerType, PartitionStateChangeListener> listeners =
        mockHelixParticipant.getPartitionStateChangeListeners();
    assertTrue("Should contain storage manager listener",
        listeners.containsKey(StateModelListenerType.StorageManagerListener));

    // 1. Test case where new replica(store) is successfully added into StorageManager
    PartitionId newPartition = clusterMap.createNewPartition(Collections.singletonList(localNode));
    mockHelixParticipant.onPartitionBecomeBootstrapFromOffline(newPartition.toPathString());
    // verify that compaction is disabled for the new replica
    assertTrue("The store's compaction should be disabled",
        storageManager.compactionDisabledForBlobStore(newPartition));
    // Other validation is already done in replicaFromOfflineToBoostrap test
    mockHelixParticipant.onPartitionBecomeStandbyFromBootstrap(newPartition.toPathString());
    assertFalse("The store's compaction should not be disabled",
        storageManager.compactionDisabledForBlobStore(newPartition));
  }
test that both success and failure in storage manager when replica becomes BOOTSTRAP from OFFLINE (update
InstanceConfig in Helix is turned off in this test)
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/StorageManagerTest.java