From db9da432b9ae343bf13c4f3ed45e4c8b8c20a84f Mon Sep 17 00:00:00 2001 From: Inigo Goiri Date: Mon, 23 Apr 2018 19:12:16 -0700 Subject: [PATCH] HDFS-13336. Test cases of TestWriteToReplica failed in windows. Contributed by Xiao Liang. (cherry picked from commit df92a17e02fe86279a6f4e413719d0a465b50837) --- .../fsdataset/impl/TestWriteToReplica.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestWriteToReplica.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestWriteToReplica.java index e7c680cfb74..f6b16881200 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestWriteToReplica.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestWriteToReplica.java @@ -20,6 +20,7 @@ package org.apache.hadoop.hdfs.server.datanode.fsdataset.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.util.ArrayList; @@ -63,7 +64,8 @@ public class TestWriteToReplica { // test close @Test public void testClose() throws Exception { - MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration()).build(); + MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration(), + new File(GenericTestUtils.getRandomizedTempPath())).build(); try { cluster.waitActive(); @@ -85,7 +87,8 @@ public class TestWriteToReplica { // test append @Test public void testAppend() throws Exception { - MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration()).build(); + MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration(), + new File(GenericTestUtils.getRandomizedTempPath())).build(); try { cluster.waitActive(); DataNode dn = cluster.getDataNodes().get(0); @@ -105,7 +108,8 @@ public class TestWriteToReplica { // test writeToRbw @Test public void testWriteToRbw() throws Exception { - MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration()).build(); + MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration(), + new File(GenericTestUtils.getRandomizedTempPath())).build(); try { cluster.waitActive(); DataNode dn = cluster.getDataNodes().get(0); @@ -125,7 +129,8 @@ public class TestWriteToReplica { // test writeToTemporary @Test public void testWriteToTemporary() throws Exception { - MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration()).build(); + MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration(), + new File(GenericTestUtils.getRandomizedTempPath())).build(); try { cluster.waitActive(); DataNode dn = cluster.getDataNodes().get(0); @@ -507,7 +512,8 @@ public class TestWriteToReplica { @Test public void testReplicaMapAfterDatanodeRestart() throws Exception { Configuration conf = new HdfsConfiguration(); - MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf) + MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf, + new File(GenericTestUtils.getRandomizedTempPath())) .nnTopology(MiniDFSNNTopology.simpleFederatedTopology(2)) .build(); try { @@ -561,7 +567,8 @@ public class TestWriteToReplica { @Test public void testRecoverInconsistentRbw() throws IOException { Configuration conf = new HdfsConfiguration(); - MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build(); + MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf, + new File(GenericTestUtils.getRandomizedTempPath())).build(); cluster.waitActive(); DataNode dn = cluster.getDataNodes().get(0); FsDatasetImpl fsDataset = (FsDatasetImpl)DataNodeTestUtils.getFSDataset(dn);