From 9132eeb4ddb324cd65a1953df87064f563e1bf5b Mon Sep 17 00:00:00 2001 From: litao Date: Sat, 23 Apr 2022 11:14:06 +0800 Subject: [PATCH] HDFS-16552. Fix NPE for TestBlockManager (#4210) (cherry picked from commit 5ebbacc48023c0c71dd428df40a4352feede373b) --- .../hadoop/hdfs/server/blockmanagement/TestBlockManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java index b6bb5f2d180..01288321c84 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java @@ -854,6 +854,7 @@ public class TestBlockManager { @Test public void testSkipReconstructionWithManyBusyNodes() { + NameNode.initMetrics(new Configuration(), HdfsServerConstants.NamenodeRole.NAMENODE); long blockId = -9223372036854775776L; // real ec block id // RS-3-2 EC policy ErasureCodingPolicy ecPolicy = @@ -899,6 +900,7 @@ public class TestBlockManager { @Test public void testSkipReconstructionWithManyBusyNodes2() { + NameNode.initMetrics(new Configuration(), HdfsServerConstants.NamenodeRole.NAMENODE); long blockId = -9223372036854775776L; // real ec block id // RS-3-2 EC policy ErasureCodingPolicy ecPolicy =