Source:
public void mountPathNotFoundTest() throws Exception { MockDataNodeId dataNode = clusterMap.getDataNodes().get(0); List<ReplicaId> replicas = clusterMap.getReplicaIds(dataNode); List<String> mountPaths = dataNode.getMountPaths(); String mountPathToDelete = mountPaths.get(RANDOM.nextInt(mountPaths.size())); int downReplicaCount = 0; for (ReplicaId replica : replicas) { if (replica.getMountPath().equals(mountPathToDelete)) { downReplicaCount++; } } StorageManager storageManager = createStorageManager(replicas, metricRegistry); Utils.deleteFileOrDirectory(new File(mountPathToDelete)); storageManager.start(); Map<String, Counter> counters = metricRegistry.getCounters(); assertEquals(0, getCounterValue(counters, DiskSpaceAllocator.class.getName(), "DiskSpaceAllocatorInitFailureCount")); assertEquals(downReplicaCount, getCounterValue(counters, DiskManager.class.getName(), "TotalStoreStartFailures")); assertEquals(1, getCounterValue(counters, DiskManager.class.getName(), "DiskMountPathFailures")); checkStoreAccessibility(replicas, mountPathToDelete, storageManager); assertEquals("Compaction thread count is incorrect", mountPaths.size() - 1, TestUtils.numThreadsByThisName(CompactionManager.THREAD_NAME_PREFIX)); verifyCompactionThreadCount(storageManager, mountPaths.size() - 1); shutdownAndAssertStoresInaccessible(storageManager, replicas); assertEquals("Compaction thread count is incorrect", 0, storageManager.getCompactionThreadCount()); assertEquals(downReplicaCount, getCounterValue(counters, DiskManager.class.getName(), "TotalStoreShutdownFailures")); }

Target:
public void mountPathNotFoundTest() throws Exception { MockDataNodeId dataNode = clusterMap.getDataNodes().get(0); List<ReplicaId> replicas = clusterMap.getReplicaIds(dataNode); List<String> mountPaths = dataNode.getMountPaths(); String mountPathToDelete = mountPaths.get(RANDOM.nextInt(mountPaths.size())); int downReplicaCount = 0; for (ReplicaId replica : replicas) { if (replica.getMountPath().equals(mountPathToDelete)) { downReplicaCount++; } } Utils.deleteFileOrDirectory(new File(mountPathToDelete)); StorageManager storageManager = createStorageManager(replicas, metricRegistry); storageManager.start(); Map<String, Counter> counters = metricRegistry.getCounters(); assertEquals("DiskSpaceAllocator should not have failed to start.", 0, getCounterValue(counters, DiskSpaceAllocator.class.getName(), "DiskSpaceAllocatorInitFailureCount")); assertEquals("Unexpected number of store start failures", downReplicaCount, getCounterValue(counters, DiskManager.class.getName(), "TotalStoreStartFailures")); assertEquals("Expected 1 disk mount path failure", 1, getCounterValue(counters, DiskManager.class.getName(), "DiskMountPathFailures")); checkStoreAccessibility(replicas, mountPathToDelete, storageManager); assertEquals("Compaction thread count is incorrect", mountPaths.size() - 1, TestUtils.numThreadsByThisName(CompactionManager.THREAD_NAME_PREFIX)); verifyCompactionThreadCount(storageManager, mountPaths.size() - 1); shutdownAndAssertStoresInaccessible(storageManager, replicas); assertEquals("Compaction thread count is incorrect", 0, storageManager.getCompactionThreadCount()); assertEquals(downReplicaCount, getCounterValue(counters, DiskManager.class.getName(), "TotalStoreShutdownFailures")); }