MAPREDUCE-7284. TestCombineFileInputFormat#testMissingBlocks fails (#2136)

This commit is contained in:
Akira Ajisaka 2020-07-15 13:46:20 +09:00 committed by GitHub
parent cce5a6f609
commit 3e7b65c3e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 19 deletions

View File

@ -1626,22 +1626,15 @@ public class TestCombineFileInputFormat {
*/ */
@Test @Test
public void testMissingBlocks() throws Exception { public void testMissingBlocks() throws Exception {
String namenode = null; final Configuration conf = new Configuration();
MiniDFSCluster dfs = null;
FileSystem fileSys = null;
String testName = "testMissingBlocks";
try {
Configuration conf = new Configuration();
conf.set("fs.hdfs.impl", MissingBlockFileSystem.class.getName()); conf.set("fs.hdfs.impl", MissingBlockFileSystem.class.getName());
conf.setBoolean("dfs.replication.considerLoad", false); conf.setBoolean("dfs.replication.considerLoad", false);
dfs = new MiniDFSCluster.Builder(conf).racks(rack1).hosts(hosts1) try (MiniDFSCluster dfs = new MiniDFSCluster.Builder(conf)
.build(); .racks(rack1).hosts(hosts1).build()) {
dfs.waitActive(); dfs.waitActive();
namenode = (dfs.getFileSystem()).getUri().getHost() + ":" + final FileSystem fileSys =
(dfs.getFileSystem()).getUri().getPort(); MissingBlockFileSystem.newInstance(dfs.getURI(), conf);
fileSys = dfs.getFileSystem();
if (!fileSys.mkdirs(inDir)) { if (!fileSys.mkdirs(inDir)) {
throw new IOException("Mkdirs failed to create " + inDir.toString()); throw new IOException("Mkdirs failed to create " + inDir.toString());
} }
@ -1673,11 +1666,6 @@ public class TestCombineFileInputFormat {
assertEquals(0, fileSplit.getOffset(1)); assertEquals(0, fileSplit.getOffset(1));
assertEquals(BLOCKSIZE, fileSplit.getLength(1)); assertEquals(BLOCKSIZE, fileSplit.getLength(1));
assertEquals(hosts1[0], fileSplit.getLocations()[0]); assertEquals(hosts1[0], fileSplit.getLocations()[0]);
} finally {
if (dfs != null) {
dfs.shutdown();
}
} }
} }