HBASE-17464 Fix getNewDataTestDirOnTestFS to always return a unique path

Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
Zach York 2017-01-12 19:09:31 -08:00 committed by Michael Stack
parent cdee1a7034
commit 9fd5dab1a8
1 changed files with 3 additions and 3 deletions

View File

@ -564,13 +564,13 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
//the working directory, and create a unique sub dir there
FileSystem fs = getTestFileSystem();
Path newDataTestDir;
String randomStr = UUID.randomUUID().toString();
if (fs.getUri().getScheme().equals(FileSystem.getLocal(conf).getUri().getScheme())) {
File dataTestDir = new File(getDataTestDir().toString());
newDataTestDir = new Path(getDataTestDir(), randomStr);
File dataTestDir = new File(newDataTestDir.toString());
if (deleteOnExit()) dataTestDir.deleteOnExit();
newDataTestDir = new Path(dataTestDir.getAbsolutePath());
} else {
Path base = getBaseTestDirOnTestFS();
String randomStr = UUID.randomUUID().toString();
newDataTestDir = new Path(base, randomStr);
if (deleteOnExit()) fs.deleteOnExit(newDataTestDir);
}