Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDFS-16411 RBF: RouterId is NULL when disable RourterRpcServer #3878

Merged
merged 9 commits into from
Feb 8, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,14 @@ public void testRouterMetricsWhenDisabled() throws Exception {

@Test
public void testSwitchRouter() throws IOException {
assertRouterHeartbeater(true, true);
assertRouterHeartbeater(true, false);
assertRouterHeartbeater(false, true);
assertRouterHeartbeater(false, false);
assertRouterHeartbeater(true,true, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch the spaces after the comma.

Copy link
Contributor Author

@yulongz yulongz Jan 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your advice. In the latest commit e208d71 , it has been done.

Suggested change
assertRouterHeartbeater(true,true, true);
assertRouterHeartbeater(true, true, true);

assertRouterHeartbeater(true,true, false);
assertRouterHeartbeater(true,false, true);
assertRouterHeartbeater(true,false, false);
assertRouterHeartbeater(false,true, true);
assertRouterHeartbeater(false,true, false);
assertRouterHeartbeater(false,false, true);
assertRouterHeartbeater(false,false, false);
}

/**
Expand All @@ -235,10 +239,10 @@ public void testSwitchRouter() throws IOException {
* @param expectedRouterHeartbeat expect the routerHeartbeat enable state.
* @param expectedNNHeartbeat expect the nnHeartbeat enable state.
*/
private void assertRouterHeartbeater(boolean expectedRouterHeartbeat,
private void assertRouterHeartbeater(boolean enableRpcServer, boolean expectedRouterHeartbeat,
boolean expectedNNHeartbeat) throws IOException {
final Router router = new Router();
Configuration baseCfg = new RouterConfigBuilder(conf).rpc(false).build();
Configuration baseCfg = new RouterConfigBuilder(conf).rpc(enableRpcServer).build();
baseCfg.setBoolean(RBFConfigKeys.DFS_ROUTER_HEARTBEAT_ENABLE,
expectedRouterHeartbeat);
baseCfg.setBoolean(RBFConfigKeys.DFS_ROUTER_NAMENODE_HEARTBEAT_ENABLE,
Expand Down