From 91997872155e4b4b99c3dea7baccddbf2af9aa19 Mon Sep 17 00:00:00 2001 From: litao Date: Wed, 2 Mar 2022 11:25:50 +0800 Subject: [PATCH] HDFS-16458. [SPS]: Fix bug for unit test of reconfiguring SPS mode (#4041) --- .../hdfs/server/namenode/TestNameNodeReconfigure.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeReconfigure.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeReconfigure.java index fe555532cbc..33debdb1492 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeReconfigure.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeReconfigure.java @@ -307,6 +307,8 @@ public class TestNameNodeReconfigure { StoragePolicySatisfierMode.EXTERNAL.toString(), nameNode.getConf().get(DFS_STORAGE_POLICY_SATISFIER_MODE_KEY, DFS_STORAGE_POLICY_SATISFIER_MODE_DEFAULT)); + assertNotNull("SPS Manager should be created", + nameNode.getNamesystem().getBlockManager().getSPSManager()); } /** @@ -322,6 +324,8 @@ public class TestNameNodeReconfigure { StoragePolicySatisfierMode.NONE.toString()); verifySPSEnabled(nameNode, DFS_STORAGE_POLICY_SATISFIER_MODE_KEY, StoragePolicySatisfierMode.NONE, false); + assertNull("SPS Manager should be null", + nameNode.getNamesystem().getBlockManager().getSPSManager()); Path filePath = new Path("/testSPS"); DistributedFileSystem fileSystem = cluster.getFileSystem(); @@ -345,7 +349,7 @@ public class TestNameNodeReconfigure { .getNamesystem().getBlockManager().getSPSManager(); boolean isSPSRunning = spsMgr != null ? spsMgr.isSatisfierRunning() : false; - assertEquals(property + " has wrong value", isSPSRunning, isSPSRunning); + assertEquals(property + " has wrong value", isSatisfierRunning, isSPSRunning); String actual = nameNode.getConf().get(property, DFS_STORAGE_POLICY_SATISFIER_MODE_DEFAULT); assertEquals(property + " has wrong value", expected,