@Test
public void testAddVolumeWithSameStorageUuid() throws IOException {

  HdfsConfiguration config = new HdfsConfiguration();
  MiniDFSCluster cluster = new MiniDFSCluster.Builder(config)
      .numDataNodes(1).build();
  try {
    cluster.waitActive();
    assertTrue(cluster.getDataNodes().get(0).isConnectedToNN(
        cluster.getNameNode().getServiceRpcAddress()));
    MiniDFSCluster.DataNodeProperties dn = cluster.stopDataNode(0);
    File vol0 = cluster.getStorageDir(0, 0);
    File vol1 = cluster.getStorageDir(0, 1);
    Storage.StorageDirectory sd0 = new Storage.StorageDirectory(vol0);
    Storage.StorageDirectory sd1 = new Storage.StorageDirectory(vol1);
    FileUtils.copyFile(sd0.getVersionFile(), sd1.getVersionFile());
    cluster.restartDataNode(dn, true);
    cluster.waitActive();
    assertFalse(cluster.getDataNodes().get(0).isConnectedToNN(
        cluster.getNameNode().getServiceRpcAddress()));
  } finally {
    cluster.shutdown();
  }
}