HDFS-13673. TestNameNodeMetrics fails on Windows. Contributed by Zuoming Zhang.

(cherry picked from commit 43d994e4a6)
This commit is contained in:
Inigo Goiri 2018-06-15 10:33:28 -07:00
parent fd7cd596b7
commit 4add4c1be0
1 changed files with 3 additions and 1 deletions

View File

@ -71,6 +71,7 @@ import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager; import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManagerTestUtil; import org.apache.hadoop.hdfs.server.blockmanagement.BlockManagerTestUtil;
import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor; import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor;
import org.apache.hadoop.hdfs.server.common.Storage;
import org.apache.hadoop.hdfs.server.datanode.DataNode; import org.apache.hadoop.hdfs.server.datanode.DataNode;
import org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils; import org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils;
import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi; import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi;
@ -271,7 +272,8 @@ public class TestNameNodeMetrics {
File dataDir = new File(fsVolume.getBaseURI()); File dataDir = new File(fsVolume.getBaseURI());
long capacity = fsVolume.getCapacity(); long capacity = fsVolume.getCapacity();
volumeReferences.close(); volumeReferences.close();
DataNodeTestUtils.injectDataDirFailure(dataDir); File storageDir = new File(dataDir, Storage.STORAGE_DIR_CURRENT);
DataNodeTestUtils.injectDataDirFailure(storageDir);
DataNodeTestUtils.waitForDiskError(dn, fsVolume); DataNodeTestUtils.waitForDiskError(dn, fsVolume);
DataNodeTestUtils.triggerHeartbeat(dn); DataNodeTestUtils.triggerHeartbeat(dn);
BlockManagerTestUtil.checkHeartbeat(bm); BlockManagerTestUtil.checkHeartbeat(bm);