浏览代码

HDFS-13567. TestNameNodeMetrics#testGenerateEDEKTime,TestNameNodeMetrics#testResourceCheck should use a different cluster basedir. Contributed by Anbang Hu.

(cherry picked from commit 63480976a008bab0b84f4da08b1099867e5a9a6b)
Inigo Goiri 7 年之前
父节点
当前提交
3d48a895a6

+ 6 - 2
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/metrics/TestNameNodeMetrics.java

@@ -770,8 +770,10 @@ public class TestNameNodeMetrics {
         .DFS_NAMENODE_DELEGATION_TOKEN_ALWAYS_USE_KEY, true);
         .DFS_NAMENODE_DELEGATION_TOKEN_ALWAYS_USE_KEY, true);
     conf.setInt(DFSConfigKeys.DFS_NAMENODE_LIST_ENCRYPTION_ZONES_NUM_RESPONSES,
     conf.setInt(DFSConfigKeys.DFS_NAMENODE_LIST_ENCRYPTION_ZONES_NUM_RESPONSES,
         2);
         2);
+    File basedir = new File(MiniDFSCluster.getBaseDirectory(),
+        GenericTestUtils.getMethodName());
 
 
-    try (MiniDFSCluster clusterEDEK = new MiniDFSCluster.Builder(conf)
+    try (MiniDFSCluster clusterEDEK = new MiniDFSCluster.Builder(conf, basedir)
         .numDataNodes(1).build()) {
         .numDataNodes(1).build()) {
 
 
       DistributedFileSystem fsEDEK =
       DistributedFileSystem fsEDEK =
@@ -807,7 +809,9 @@ public class TestNameNodeMetrics {
   @Test
   @Test
   public void testResourceCheck() throws Exception {
   public void testResourceCheck() throws Exception {
     HdfsConfiguration conf = new HdfsConfiguration();
     HdfsConfiguration conf = new HdfsConfiguration();
-    MiniDFSCluster tmpCluster = new MiniDFSCluster.Builder(conf)
+    File basedir = new File(MiniDFSCluster.getBaseDirectory(),
+        GenericTestUtils.getMethodName());
+    MiniDFSCluster tmpCluster = new MiniDFSCluster.Builder(conf, basedir)
         .numDataNodes(0)
         .numDataNodes(0)
         .nnTopology(MiniDFSNNTopology.simpleHATopology())
         .nnTopology(MiniDFSNNTopology.simpleHATopology())
         .build();
         .build();