|
@@ -21,7 +21,6 @@ package org.apache.hadoop.hdfs.server.namenode;
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
|
|
-import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -29,7 +28,6 @@ import java.util.List;
|
|
|
import org.apache.commons.logging.Log;
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
-import org.apache.hadoop.fs.DF;
|
|
|
import org.apache.hadoop.fs.Path;
|
|
|
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
|
|
import org.apache.hadoop.hdfs.DFSOutputStream;
|
|
@@ -45,6 +43,7 @@ import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor;
|
|
|
import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager;
|
|
|
import org.apache.hadoop.hdfs.server.datanode.DataNode;
|
|
|
import org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils;
|
|
|
+import org.apache.hadoop.hdfs.server.datanode.FsDatasetTestUtils;
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
@@ -110,9 +109,7 @@ public class TestNamenodeCapacityReport {
|
|
|
assertTrue(percentBpUsed == DFSUtilClient.getPercentUsed(bpUsed,
|
|
|
configCapacity));
|
|
|
}
|
|
|
-
|
|
|
- DF df = new DF(new File(cluster.getDataDirectory()), conf);
|
|
|
-
|
|
|
+
|
|
|
//
|
|
|
// Currently two data directories are created by the data node
|
|
|
// in the MiniDFSCluster. This results in each data directory having
|
|
@@ -123,9 +120,10 @@ public class TestNamenodeCapacityReport {
|
|
|
// So multiply the disk capacity and reserved space by two
|
|
|
// for accommodating it
|
|
|
//
|
|
|
- int numOfDataDirs = 2;
|
|
|
-
|
|
|
- long diskCapacity = numOfDataDirs * df.getCapacity();
|
|
|
+ final FsDatasetTestUtils utils = cluster.getFsDatasetTestUtils(0);
|
|
|
+ int numOfDataDirs = utils.getDefaultNumOfDataDirs();
|
|
|
+
|
|
|
+ long diskCapacity = numOfDataDirs * utils.getRawCapacity();
|
|
|
reserved *= numOfDataDirs;
|
|
|
|
|
|
configCapacity = namesystem.getCapacityTotal();
|