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

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

View File

@ -975,6 +975,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.commons.logging.impl.Log4JLogger;
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 @@ public class TestNameNodeMetricsLogger {
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) {