Skip to content

Commit 832bc38

Browse files
committed
HDFS-16411 RBF: RouterId is NULL when set dfs.federation.router.rpc.enable=false; modify testSwitchRouter()
1 parent dc03d2d commit 832bc38

File tree

1 file changed

+10
-6
lines changed
  • hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router

1 file changed

+10
-6
lines changed

hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouter.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,14 @@ public void testRouterMetricsWhenDisabled() throws Exception {
223223

224224
@Test
225225
public void testSwitchRouter() throws IOException {
226-
assertRouterHeartbeater(true, true);
227-
assertRouterHeartbeater(true, false);
228-
assertRouterHeartbeater(false, true);
229-
assertRouterHeartbeater(false, false);
226+
assertRouterHeartbeater(true,true, true);
227+
assertRouterHeartbeater(true,true, false);
228+
assertRouterHeartbeater(true,false, true);
229+
assertRouterHeartbeater(true,false, false);
230+
assertRouterHeartbeater(false,true, true);
231+
assertRouterHeartbeater(false,true, false);
232+
assertRouterHeartbeater(false,false, true);
233+
assertRouterHeartbeater(false,false, false);
230234
}
231235

232236
/**
@@ -235,10 +239,10 @@ public void testSwitchRouter() throws IOException {
235239
* @param expectedRouterHeartbeat expect the routerHeartbeat enable state.
236240
* @param expectedNNHeartbeat expect the nnHeartbeat enable state.
237241
*/
238-
private void assertRouterHeartbeater(boolean expectedRouterHeartbeat,
242+
private void assertRouterHeartbeater(boolean enableRpcServer, boolean expectedRouterHeartbeat,
239243
boolean expectedNNHeartbeat) throws IOException {
240244
final Router router = new Router();
241-
Configuration baseCfg = new RouterConfigBuilder(conf).rpc(false).build();
245+
Configuration baseCfg = new RouterConfigBuilder(conf).rpc(enableRpcServer).build();
242246
baseCfg.setBoolean(RBFConfigKeys.DFS_ROUTER_HEARTBEAT_ENABLE,
243247
expectedRouterHeartbeat);
244248
baseCfg.setBoolean(RBFConfigKeys.DFS_ROUTER_NAMENODE_HEARTBEAT_ENABLE,

0 commit comments

Comments
 (0)