HDFS-13588. Fix TestFsDatasetImpl test failures on Windows. Contributed by Xiao Liang.
(cherry picked from commit c0c9b7a8ef2618b7641a0452d9277abd26815de2) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8d8ef081 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8d8ef081 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8d8ef081 Branch: refs/heads/branch-3.0 Commit: 8d8ef081a2790ab4fab61ef945f3e0f238f9262d Parents: 6db710b Author: Inigo Goiri <inigo...@apache.org> Authored: Wed May 23 09:46:35 2018 -0700 Committer: Inigo Goiri <inigo...@apache.org> Committed: Wed May 23 09:47:32 2018 -0700 ---------------------------------------------------------------------- .../server/datanode/fsdataset/impl/TestFsDatasetImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8d8ef081/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestFsDatasetImpl.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestFsDatasetImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestFsDatasetImpl.java index a30329c..865487e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestFsDatasetImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestFsDatasetImpl.java @@ -25,6 +25,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystemTestHelper; +import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.StorageType; import org.apache.hadoop.hdfs.DFSConfigKeys; @@ -654,7 +655,8 @@ public class TestFsDatasetImpl { TimeUnit.MILLISECONDS); config.setInt(DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY, 1); - cluster = new MiniDFSCluster.Builder(config).numDataNodes(1).build(); + cluster = new MiniDFSCluster.Builder(config, + GenericTestUtils.getRandomizedTestDir()).numDataNodes(1).build(); cluster.waitActive(); FileSystem fs = cluster.getFileSystem(); DataNode dataNode = cluster.getDataNodes().get(0); @@ -676,7 +678,7 @@ public class TestFsDatasetImpl { // Remove write and execute access so that checkDiskErrorThread detects // this volume is bad. finalizedDir.setExecutable(false); - finalizedDir.setWritable(false); + assertTrue(FileUtil.setWritable(finalizedDir, false)); } Assert.assertTrue("Reference count for the volume should be greater " + "than 0", volume.getReferenceCount() > 0); @@ -697,7 +699,7 @@ public class TestFsDatasetImpl { } catch (IOException ioe) { GenericTestUtils.assertExceptionContains(info.getXferAddr(), ioe); } - finalizedDir.setWritable(true); + assertTrue(FileUtil.setWritable(finalizedDir, true)); finalizedDir.setExecutable(true); } finally { cluster.shutdown(); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org