@Test
  public void storeRemoveDirectoryAndRestartTestWithStoppedReplica() throws Exception {
    generateConfigs(true, false, false, 2, true, false);
    MockDataNodeId dataNode = clusterMap.getDataNodes().get(0);
    ReplicaId replica = clusterMap.getReplicaIds(dataNode).get(0);

    // Start a storage manager so the replica's first log segment would be created
    StorageManager storageManager = createStorageManager(dataNode, metricRegistry, null);
    storageManager.start();
    storageManager.shutdown();

    ClusterParticipant mockParticipant = new MockClusterParticipant();
    mockParticipant.setReplicaStoppedState(Collections.singletonList(replica), true);
    // The first log segment is corrupted, but this replica is also in stopped replicas list, it will not be restarted
    corruptFirstLogSegment(replica);
    storageManager = createStorageManager(dataNode, metricRegistry, Collections.singletonList(mockParticipant));
    storageManager.start();
    assertNull(storageManager.getStore(replica.getPartitionId(), false));
    storageManager.shutdown();
  }
Test the case where the blob store can't get started and we need to remove the directory and then restart the blobstore.
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/StorageManagerTest.java