|
@@ -67,10 +67,7 @@ public class TestQuotaByStorageType {
|
|
|
.storageTypes(new StorageType[]{StorageType.SSD, StorageType.DEFAULT})
|
|
|
.build();
|
|
|
cluster.waitActive();
|
|
|
-
|
|
|
- fsdir = cluster.getNamesystem().getFSDirectory();
|
|
|
- dfs = cluster.getFileSystem();
|
|
|
- fsn = cluster.getNamesystem();
|
|
|
+ refreshClusterState();
|
|
|
}
|
|
|
|
|
|
@After
|
|
@@ -80,6 +77,13 @@ public class TestQuotaByStorageType {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Cluster state must be refreshed after each start/restart in the test
|
|
|
+ private void refreshClusterState() throws IOException{
|
|
|
+ fsdir = cluster.getNamesystem().getFSDirectory();
|
|
|
+ dfs = cluster.getFileSystem();
|
|
|
+ fsn = cluster.getNamesystem();
|
|
|
+ }
|
|
|
+
|
|
|
@Test(timeout = 60000)
|
|
|
public void testQuotaByStorageTypeWithFileCreateOneSSD() throws Exception {
|
|
|
testQuotaByStorageTypeWithFileCreateCase(
|
|
@@ -662,6 +666,7 @@ public class TestQuotaByStorageType {
|
|
|
|
|
|
// Restart namenode to make sure the editlog is correct
|
|
|
cluster.restartNameNode(true);
|
|
|
+ refreshClusterState();
|
|
|
|
|
|
INode testDirNodeAfterNNRestart = fsdir.getINode4Write(testDir.toString());
|
|
|
// Verify quota is still set
|
|
@@ -714,6 +719,7 @@ public class TestQuotaByStorageType {
|
|
|
dfs.saveNamespace();
|
|
|
dfs.setSafeMode(HdfsConstants.SafeModeAction.SAFEMODE_LEAVE);
|
|
|
cluster.restartNameNode(true);
|
|
|
+ refreshClusterState();
|
|
|
|
|
|
INode testDirNodeAfterNNRestart = fsdir.getINode4Write(testDir.toString());
|
|
|
assertTrue(testDirNode.isDirectory());
|