HDFS-9458. TestBackupNode always binds to port 50070, which can cause bind failures. Contributed by Xiao Chen.

(cherry picked from commit 5c0ff69618)
This commit is contained in:
cnauroth 2015-12-22 10:29:35 -08:00
parent a56c5ef636
commit 9b039a5004
2 changed files with 9 additions and 3 deletions

View File

@ -1667,6 +1667,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9589. Block files which have been hardlinked should be duplicated HDFS-9589. Block files which have been hardlinked should be duplicated
before the DataNode appends to the them (cmccabe) before the DataNode appends to the them (cmccabe)
HDFS-9458. TestBackupNode always binds to port 50070, which can cause bind
failures. (Xiao Chen via cnauroth)
Release 2.7.3 - UNRELEASED Release 2.7.3 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -48,6 +48,7 @@ import org.apache.hadoop.hdfs.server.common.Storage.StorageDirectory;
import org.apache.hadoop.hdfs.server.namenode.FileJournalManager.EditLogFile; import org.apache.hadoop.hdfs.server.namenode.FileJournalManager.EditLogFile;
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocols; import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocols;
import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.net.ServerSocketUtil;
import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.test.GenericTestUtils;
@ -143,8 +144,9 @@ public class TestBackupNode {
Configuration c = new HdfsConfiguration(); Configuration c = new HdfsConfiguration();
StartupOption startupOpt = StartupOption.CHECKPOINT; StartupOption startupOpt = StartupOption.CHECKPOINT;
String dirs = getBackupNodeDir(startupOpt, 1); String dirs = getBackupNodeDir(startupOpt, 1);
c.set(DFSConfigKeys.FS_DEFAULT_NAME_KEY, "hdfs://127.0.0.1:1234"); c.set(DFSConfigKeys.FS_DEFAULT_NAME_KEY,
c.set(DFSConfigKeys.DFS_NAMENODE_BACKUP_HTTP_ADDRESS_KEY, "localhost:0"); "hdfs://127.0.0.1:" + ServerSocketUtil.getPort(0, 100));
c.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY, "127.0.0.1:0");
c.set(DFSConfigKeys.DFS_BLOCKREPORT_INITIAL_DELAY_KEY, "0"); c.set(DFSConfigKeys.DFS_BLOCKREPORT_INITIAL_DELAY_KEY, "0");
c.setInt(DFSConfigKeys.DFS_DATANODE_SCAN_PERIOD_HOURS_KEY, c.setInt(DFSConfigKeys.DFS_DATANODE_SCAN_PERIOD_HOURS_KEY,
-1); // disable block scanner -1); // disable block scanner
@ -179,7 +181,8 @@ public class TestBackupNode {
bn.getNamesystem() == null); bn.getNamesystem() == null);
fail("Incorrect authentication setting should throw IOException"); fail("Incorrect authentication setting should throw IOException");
} catch (IOException e) { } catch (IOException e) {
LOG.info("IOException thrown as expected", e); LOG.info("IOException thrown.", e);
assertTrue(e.getMessage().contains("Running in secure mode"));
} finally { } finally {
if (nn != null) { if (nn != null) {
nn.stop(); nn.stop();