Revert "Revert "HBASE-16983 TestMultiTableSnapshotInputFormat failing with Unable to create region directory: /tmp/... (Addendum by Guanghao Zhang)""

This is a revert of a revert, i.e. puts back the change only I added
HBaseCommonTestingUtility#getRandomDir from branch-1 too since
missing in master branch.

This reverts commit 9afcb4366d.
This commit is contained in:
Michael Stack 2016-11-08 12:36:23 -08:00
parent c3b98b87fb
commit 0998af01df
2 changed files with 10 additions and 6 deletions

View File

@ -108,10 +108,7 @@ public class HBaseCommonTestingUtility {
dataTestDir.getAbsolutePath()); dataTestDir.getAbsolutePath());
return null; return null;
} }
Path testPath = getRandomDir();
String randomStr = UUID.randomUUID().toString();
Path testPath = new Path(getBaseTestDir(), randomStr);
this.dataTestDir = new File(testPath.toString()).getAbsoluteFile(); this.dataTestDir = new File(testPath.toString()).getAbsoluteFile();
// Set this property so if mapreduce jobs run, they will use this as their home dir. // Set this property so if mapreduce jobs run, they will use this as their home dir.
System.setProperty("test.build.dir", this.dataTestDir.toString()); System.setProperty("test.build.dir", this.dataTestDir.toString());
@ -122,6 +119,14 @@ public class HBaseCommonTestingUtility {
return testPath; return testPath;
} }
/**
* @return A dir with a random (uuid) name under the test dir
* @see #getBaseTestDir()
*/
public Path getRandomDir() {
return new Path(getBaseTestDir(), UUID.randomUUID().toString());
}
protected void createSubDir(String propertyName, Path parent, String subDirName) { protected void createSubDir(String propertyName, Path parent, String subDirName) {
Path newPath = new Path(parent, subDirName); Path newPath = new Path(parent, subDirName);
File newDir = new File(newPath.toString()).getAbsoluteFile(); File newDir = new File(newPath.toString()).getAbsoluteFile();

View File

@ -64,8 +64,7 @@ public class TestMultiTableSnapshotInputFormat extends MultiTableInputFormatTest
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
this.restoreDir = TEST_UTIL.getDataTestDir(); this.restoreDir = TEST_UTIL.getRandomDir();
} }
@Override @Override