@Test
  public void storeStartupTests() throws IOException, StoreException {

    // Since store creation can fail in this test before the metric has initialized, set the memory usage metric to false.
    properties.put("store.enable.index.direct.memory.usage.metric", "false");
    enableIndexDirectMemoryUsageMetric = false;

    // attempt to start when store is already started fails
    verifyStartupFailure(store, StoreErrorCodes.StoreAlreadyStarted);

    String nonExistentDir = new File(tempDir, TestUtils.getRandomString(10)).getAbsolutePath();

    // fail if attempt to create directory fails
    String badPath = new File(nonExistentDir, TestUtils.getRandomString(10)).getAbsolutePath();

    BlobStore blobStore = createBlobStore(getMockReplicaId(badPath));

    verifyStartupFailure(blobStore, StoreErrorCodes.InitializationError);

    ReplicaId replicaIdWithNonExistentDir = getMockReplicaId(nonExistentDir);

    // create directory if it does not exist
    blobStore = createBlobStore(replicaIdWithNonExistentDir);
    verifyStartupSuccess(blobStore);
    File createdDir = new File(nonExistentDir);
    assertTrue("Directory should now exist", createdDir.exists() && createdDir.isDirectory());

    // should not be able to start two stores at the same path
    blobStore = createBlobStore(replicaIdWithNonExistentDir);
    blobStore.start();
    BlobStore secondStore = createBlobStore(replicaIdWithNonExistentDir);
    verifyStartupFailure(secondStore, StoreErrorCodes.InitializationError);
    blobStore.shutdown();

    // fail if directory is not readable
    assertTrue("Could not set readable state to false", createdDir.setReadable(false));
    verifyStartupFailure(blobStore, StoreErrorCodes.InitializationError);

    assertTrue("Could not set readable state to true", createdDir.setReadable(true));
    assertTrue("Directory could not be deleted", cleanDirectory(createdDir, true));

    // fail if provided path is not a directory
    File file = new File(tempDir, TestUtils.getRandomString(10));
    assertTrue("Test file could not be created", file.createNewFile());
    file.deleteOnExit();
    blobStore = createBlobStore(getMockReplicaId(file.getAbsolutePath()));
    verifyStartupFailure(blobStore, StoreErrorCodes.InitializationError);
  }
Tests {@link BlobStore#start()} for corner cases and error cases.
Corner cases
1. Creating a directory on first startup
Error cases
1. Start an already started store.
2. Unable to create store directory on first startup.
3. Starting two stores at the same path.
4. Directory not readable.
5. Path is not a directory.
@throws IOException
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java