HDFS-12112. TestBlockManager#testBlockManagerMachinesArray sometimes fails with NPE. Contributed by Wei-Chiu Chuang.

(cherry picked from commit b778887af5)
This commit is contained in:
Brahma Reddy Battula 2017-07-15 10:38:31 +08:00
parent 8b7d1df766
commit 6039a2a55f
1 changed files with 3 additions and 1 deletions

View File

@ -1149,7 +1149,7 @@ public class TestBlockManager {
} }
} }
@Test @Test(timeout = 60000)
public void testBlockManagerMachinesArray() throws Exception { public void testBlockManagerMachinesArray() throws Exception {
final Configuration conf = new HdfsConfiguration(); final Configuration conf = new HdfsConfiguration();
final MiniDFSCluster cluster = final MiniDFSCluster cluster =
@ -1160,6 +1160,8 @@ public class TestBlockManager {
final Path filePath = new Path("/tmp.txt"); final Path filePath = new Path("/tmp.txt");
final long fileLen = 1L; final long fileLen = 1L;
DFSTestUtil.createFile(fs, filePath, fileLen, (short) 3, 1L); DFSTestUtil.createFile(fs, filePath, fileLen, (short) 3, 1L);
DFSTestUtil.waitForReplication((DistributedFileSystem)fs,
filePath, (short) 3, 60000);
ArrayList<DataNode> datanodes = cluster.getDataNodes(); ArrayList<DataNode> datanodes = cluster.getDataNodes();
assertEquals(datanodes.size(), 4); assertEquals(datanodes.size(), 4);
FSNamesystem ns = cluster.getNamesystem(); FSNamesystem ns = cluster.getNamesystem();