浏览代码

HDFS-16140. TestBootstrapAliasmap fails by BindException. (#3229)

Reviewed-by: Hui Fei <ferhui@apache.org>
Akira Ajisaka 3 年之前
父节点
当前提交
d710ec8d85

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestBootstrapAliasmap.java

@@ -51,6 +51,9 @@ public class TestBootstrapAliasmap {
   public void setup() throws Exception {
     Configuration conf = new Configuration();
     MiniDFSCluster.setupNamenodeProvidedConfiguration(conf);
+    // use free port instead of default 50200 port
+    conf.set(DFSConfigKeys.DFS_PROVIDED_ALIASMAP_INMEMORY_RPC_ADDRESS,
+            "127.0.0.1:" + NetUtils.getFreeSocketPort());
     cluster = new MiniDFSCluster.Builder(conf)
         .numDataNodes(1)
         .build();