HDFS-9069. TestNameNodeMetricsLogger failing -port in use. (stevel)

This commit is contained in:
Steve Loughran 2015-09-14 10:36:34 +01:00
parent e1b1d7e4ae
commit 6955771261
2 changed files with 6 additions and 2 deletions

View File

@ -1322,6 +1322,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9041. Move entries in META-INF/services/o.a.h.fs.FileSystem to
hdfs-client. (Mingliang Liu via wheat9)
HDFS-9069. TestNameNodeMetricsLogger failing -port in use.
(stevel)
Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -25,6 +25,7 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.metrics2.util.MBeans;
import org.apache.hadoop.net.ServerSocketUtil;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.log4j.Appender;
import org.apache.log4j.AppenderSkeleton;
@ -118,8 +119,8 @@ private NameNode makeNameNode(boolean enableMetricsLogging)
return new TestNameNode(conf);
}
private int getRandomPort() {
return 10000 + random.nextInt(50000);
private int getRandomPort() throws IOException {
return ServerSocketUtil.getPort(0, 10);
}
private void addAppender(Log log, Appender appender) {