From ec5ef0bb20a8a1b3e8949f0c55db4b63b0edba7d Mon Sep 17 00:00:00 2001 From: Inigo Goiri Date: Mon, 4 Jun 2018 18:28:11 -0700 Subject: [PATCH] HDFS-13650. Randomize baseDir for MiniDFSCluster in TestDFSStripedInputStream and TestDFSStripedInputStreamWithRandomECPolicy. Contributed by Anbang Hu. (cherry picked from commit 8d31ddcfeb5c2e97692dd386e5bd62f433b44f8e) --- .../org/apache/hadoop/hdfs/TestDFSStripedInputStream.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStripedInputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStripedInputStream.java index 422746e33c4..48ecf9ae5e8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStripedInputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStripedInputStream.java @@ -105,7 +105,13 @@ public class TestDFSStripedInputStream { CodecUtil.IO_ERASURECODE_CODEC_RS_RAWCODERS_KEY, NativeRSRawErasureCoderFactory.CODER_NAME); } + conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, + GenericTestUtils.getRandomizedTempPath()); SimulatedFSDataset.setFactory(conf); + startUp(); + } + + private void startUp() throws IOException { cluster = new MiniDFSCluster.Builder(conf).numDataNodes( dataBlocks + parityBlocks).build(); cluster.waitActive(); @@ -326,7 +332,7 @@ public class TestDFSStripedInputStream { if (cellMisalignPacket) { conf.setInt(IO_FILE_BUFFER_SIZE_KEY, IO_FILE_BUFFER_SIZE_DEFAULT + 1); tearDown(); - setup(); + startUp(); } DFSTestUtil.createStripedFile(cluster, filePath, null, numBlocks, stripesPerBlock, false, ecPolicy);