@Test
  public void initFailureTest() throws Exception {
    // build a pool with files that we can modify permissions on to induce failures
    alloc = constructAllocator();
    alloc.initializePool(Collections.singletonList(new DiskSpaceRequirements(storeId0, 50, 2, 0)));
    verifyPoolState(new ExpectedState().addStoreSeg(storeId0, 50, 2));

    File storeReserveDir = new File(reserveFileDir, DiskSpaceAllocator.STORE_DIR_PREFIX + storeId0);
    File fileSizeDir = new File(storeReserveDir, DiskSpaceAllocator.generateFileSizeDirName(50));

    // test a failure while deleting an unneeded directory
    runInitFailureTest(fileSizeDir, false);
    // test a failure while deleting an unneeded individual file
    runInitFailureTest(fileSizeDir, false, new DiskSpaceRequirements(storeId0, 50, 1, 0));
    // test that an inventory failure during DSA construction results in an exception thrown by initializePool
    runInitFailureTest(reserveFileDir, true);
  }
Exercises different failure cases for {@link DiskSpaceAllocator#initializePool(Collection)}.
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/DiskSpaceAllocatorTest.java