amahussein commented on a change in pull request #2722:
URL: https://github.com/apache/hadoop/pull/2722#discussion_r582374895
##########
File path:
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
##########
@@ -229,6 +229,31 @@ public static int uniqueSequenceId() {
return sequence.incrementAndGet();
}
+ /**
+ * Creates a directory for the data/logs of the unit test.
+ * It first delete the directory if it exists.
+ *
+ * @param testClass the unit test class.
+ * @param defaultTargetRootDir the directory where the class directory is
+ * created.
+ * @return the Path of the root directory.
+ */
+ public static Path setupTestRootDir(Class<?> testClass,
+ String defaultTargetRootDir) {
+ // setup the test root directory
+ String targetTestDir =
+ System.getProperty(SYSPROP_TEST_DATA_DIR, defaultTargetRootDir);
+ Path testRootDirPath =
+ new Path(targetTestDir, testClass.getSimpleName());
+ System.setProperty(GenericTestUtils.SYSPROP_TEST_DATA_DIR,
+ testRootDirPath.toString());
Review comment:
Also, if I do not set this property, the diff will be very large to get
around it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]