From 1af41dadc2a970b4a1a28274894908cac6e0e2d9 Mon Sep 17 00:00:00 2001 From: Inigo Goiri Date: Fri, 18 May 2018 09:46:02 -0700 Subject: [PATCH] HDFS-13593. TestBlockReaderLocalLegacy#testBlockReaderLocalLegacyWithAppend fails on Windows. Contributed by Anbang Hu. (cherry picked from commit 9775ecb2355d7bed3514fcd54bf69e8351c4ab99) --- .../hdfs/client/impl/TestBlockReaderLocalLegacy.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/client/impl/TestBlockReaderLocalLegacy.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/client/impl/TestBlockReaderLocalLegacy.java index 273619c10b5..285cdb61997 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/client/impl/TestBlockReaderLocalLegacy.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/client/impl/TestBlockReaderLocalLegacy.java @@ -48,6 +48,7 @@ import org.apache.hadoop.net.unix.TemporarySocketDirectory; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.token.Token; +import org.apache.hadoop.test.GenericTestUtils; import org.junit.Assert; import org.junit.Assume; import org.junit.BeforeClass; @@ -93,8 +94,9 @@ public void testStablePositionAfterCorruptRead() throws Exception { final long FILE_LENGTH = 512L; HdfsConfiguration conf = getConfiguration(null); + File basedir = new File(GenericTestUtils.getRandomizedTempPath()); MiniDFSCluster cluster = - new MiniDFSCluster.Builder(conf).numDataNodes(1).build(); + new MiniDFSCluster.Builder(conf, basedir).numDataNodes(1).build(); cluster.waitActive(); FileSystem fs = cluster.getFileSystem(); @@ -173,8 +175,9 @@ public void testBlockReaderLocalLegacyWithAppend() throws Exception { final HdfsConfiguration conf = getConfiguration(null); conf.setBoolean(HdfsClientConfigKeys.DFS_CLIENT_USE_LEGACY_BLOCKREADERLOCAL, true); + File basedir = new File(GenericTestUtils.getRandomizedTempPath()); final MiniDFSCluster cluster = - new MiniDFSCluster.Builder(conf).numDataNodes(1).build(); + new MiniDFSCluster.Builder(conf, basedir).numDataNodes(1).build(); cluster.waitActive(); final DistributedFileSystem dfs = cluster.getFileSystem();