HDFS-15657. RBF: TestRouter#testNamenodeHeartBeatEnableDefault fails by BindException (#2418)
(cherry picked from commit b3ba74d72d
)
This commit is contained in:
parent
d4129c6794
commit
8e0922edb2
@ -274,9 +274,18 @@ public void testNamenodeHeartBeatEnableDefault() throws IOException {
|
|||||||
*/
|
*/
|
||||||
private void checkNamenodeHeartBeatEnableDefault(boolean enable)
|
private void checkNamenodeHeartBeatEnableDefault(boolean enable)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final Router router = new Router();
|
try (Router router = new Router()) {
|
||||||
try {
|
// Use default config
|
||||||
Configuration config = new HdfsConfiguration();
|
Configuration config = new HdfsConfiguration();
|
||||||
|
// bind to any available port
|
||||||
|
config.set(RBFConfigKeys.DFS_ROUTER_RPC_BIND_HOST_KEY, "0.0.0.0");
|
||||||
|
config.set(RBFConfigKeys.DFS_ROUTER_RPC_ADDRESS_KEY, "127.0.0.1:0");
|
||||||
|
config.set(RBFConfigKeys.DFS_ROUTER_ADMIN_ADDRESS_KEY, "127.0.0.1:0");
|
||||||
|
config.set(RBFConfigKeys.DFS_ROUTER_ADMIN_BIND_HOST_KEY, "0.0.0.0");
|
||||||
|
config.set(RBFConfigKeys.DFS_ROUTER_HTTP_ADDRESS_KEY, "127.0.0.1:0");
|
||||||
|
config.set(RBFConfigKeys.DFS_ROUTER_HTTPS_ADDRESS_KEY, "127.0.0.1:0");
|
||||||
|
config.set(RBFConfigKeys.DFS_ROUTER_HTTP_BIND_HOST_KEY, "0.0.0.0");
|
||||||
|
|
||||||
config.setBoolean(RBFConfigKeys.DFS_ROUTER_HEARTBEAT_ENABLE, enable);
|
config.setBoolean(RBFConfigKeys.DFS_ROUTER_HEARTBEAT_ENABLE, enable);
|
||||||
router.init(config);
|
router.init(config);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
@ -284,8 +293,6 @@ private void checkNamenodeHeartBeatEnableDefault(boolean enable)
|
|||||||
} else {
|
} else {
|
||||||
assertNull(router.getNamenodeHeartbeatServices());
|
assertNull(router.getNamenodeHeartbeatServices());
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
router.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user