diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHDFSFileSystemContract.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHDFSFileSystemContract.java index c1bf6f2f28f..2d55a27e827 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHDFSFileSystemContract.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHDFSFileSystemContract.java @@ -18,6 +18,7 @@ package org.apache.hadoop.hdfs; +import java.io.File; import java.io.IOException; import org.apache.hadoop.conf.Configuration; @@ -25,6 +26,7 @@ import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.fs.FileSystemContractBaseTest; import org.apache.hadoop.fs.Path; import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.test.GenericTestUtils; public class TestHDFSFileSystemContract extends FileSystemContractBaseTest { @@ -36,7 +38,9 @@ public class TestHDFSFileSystemContract extends FileSystemContractBaseTest { Configuration conf = new HdfsConfiguration(); conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, FileSystemContractBaseTest.TEST_UMASK); - cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build(); + File basedir = GenericTestUtils.getRandomizedTestDir(); + cluster = new MiniDFSCluster.Builder(conf, basedir).numDataNodes(2) + .build(); fs = cluster.getFileSystem(); defaultWorkingDirectory = "/user/" + UserGroupInformation.getCurrentUser().getShortUserName();