HADOOP-12417. TestWebDelegationToken failing with port in use. Contributed by Mingliang Liu.
This commit is contained in:
parent
941001bfa6
commit
0832b38d48
|
@ -1129,6 +1129,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
|
|
||||||
HADOOP-12407. Test failing: hadoop.ipc.TestSaslRPC. (stevel)
|
HADOOP-12407. Test failing: hadoop.ipc.TestSaslRPC. (stevel)
|
||||||
|
|
||||||
|
HADOOP-12417. TestWebDelegationToken failing with port in use.
|
||||||
|
(Mingliang Liu via wheat9)
|
||||||
|
|
||||||
Release 2.7.2 - UNRELEASED
|
Release 2.7.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -176,13 +176,8 @@ public class TestWebDelegationToken {
|
||||||
|
|
||||||
protected Server createJettyServer() {
|
protected Server createJettyServer() {
|
||||||
try {
|
try {
|
||||||
InetAddress localhost = InetAddress.getLocalHost();
|
|
||||||
ServerSocket ss = new ServerSocket(0, 50, localhost);
|
|
||||||
int port = ss.getLocalPort();
|
|
||||||
ss.close();
|
|
||||||
jetty = new Server(0);
|
jetty = new Server(0);
|
||||||
jetty.getConnectors()[0].setHost("localhost");
|
jetty.getConnectors()[0].setHost("localhost");
|
||||||
jetty.getConnectors()[0].setPort(port);
|
|
||||||
return jetty;
|
return jetty;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw new RuntimeException("Could not setup Jetty: " + ex.getMessage(),
|
throw new RuntimeException("Could not setup Jetty: " + ex.getMessage(),
|
||||||
|
@ -192,7 +187,7 @@ public class TestWebDelegationToken {
|
||||||
|
|
||||||
protected String getJettyURL() {
|
protected String getJettyURL() {
|
||||||
Connector c = jetty.getConnectors()[0];
|
Connector c = jetty.getConnectors()[0];
|
||||||
return "http://" + c.getHost() + ":" + c.getPort();
|
return "http://" + c.getHost() + ":" + c.getLocalPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
Loading…
Reference in New Issue