[SPS]: Fix bug for unit test of reconfiguring SPS mode (#3998)

This commit is contained in:
litao 2022-02-28 21:03:59 +08:00 committed by GitHub
parent 12fa38d546
commit 8aa568cea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -307,6 +307,8 @@ public void testReconfigureStoragePolicySatisfierEnabled()
StoragePolicySatisfierMode.EXTERNAL.toString(), StoragePolicySatisfierMode.EXTERNAL.toString(),
nameNode.getConf().get(DFS_STORAGE_POLICY_SATISFIER_MODE_KEY, nameNode.getConf().get(DFS_STORAGE_POLICY_SATISFIER_MODE_KEY,
DFS_STORAGE_POLICY_SATISFIER_MODE_DEFAULT)); DFS_STORAGE_POLICY_SATISFIER_MODE_DEFAULT));
assertNotNull("SPS Manager should be created",
nameNode.getNamesystem().getBlockManager().getSPSManager());
} }
/** /**
@ -322,6 +324,8 @@ public void testSatisfyStoragePolicyAfterSatisfierDisabled()
StoragePolicySatisfierMode.NONE.toString()); StoragePolicySatisfierMode.NONE.toString());
verifySPSEnabled(nameNode, DFS_STORAGE_POLICY_SATISFIER_MODE_KEY, verifySPSEnabled(nameNode, DFS_STORAGE_POLICY_SATISFIER_MODE_KEY,
StoragePolicySatisfierMode.NONE, false); StoragePolicySatisfierMode.NONE, false);
assertNull("SPS Manager should be null",
nameNode.getNamesystem().getBlockManager().getSPSManager());
Path filePath = new Path("/testSPS"); Path filePath = new Path("/testSPS");
DistributedFileSystem fileSystem = cluster.getFileSystem(); DistributedFileSystem fileSystem = cluster.getFileSystem();
@ -345,7 +349,7 @@ void verifySPSEnabled(final NameNode nameNode, String property,
.getNamesystem().getBlockManager().getSPSManager(); .getNamesystem().getBlockManager().getSPSManager();
boolean isSPSRunning = spsMgr != null ? spsMgr.isSatisfierRunning() boolean isSPSRunning = spsMgr != null ? spsMgr.isSatisfierRunning()
: false; : false;
assertEquals(property + " has wrong value", isSPSRunning, isSPSRunning); assertEquals(property + " has wrong value", isSatisfierRunning, isSPSRunning);
String actual = nameNode.getConf().get(property, String actual = nameNode.getConf().get(property,
DFS_STORAGE_POLICY_SATISFIER_MODE_DEFAULT); DFS_STORAGE_POLICY_SATISFIER_MODE_DEFAULT);
assertEquals(property + " has wrong value", expected, assertEquals(property + " has wrong value", expected,