diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStorePerf.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStorePerf.java index 4b0b06a633e..bd25defc223 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStorePerf.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStorePerf.java @@ -91,7 +91,9 @@ public class TestZKRMStateStorePerf extends RMStateStoreTestBase if (appTokenMgr != null) { appTokenMgr.stop(); } - curatorTestingServer.stop(); + if (curatorTestingServer != null) { + curatorTestingServer.stop(); + } } private void initStore(String hostPort) { @@ -99,8 +101,9 @@ public class TestZKRMStateStorePerf extends RMStateStoreTestBase RMContext rmContext = mock(RMContext.class); conf = new YarnConfiguration(); - conf.set(YarnConfiguration.RM_ZK_ADDRESS, - optHostPort.or(curatorTestingServer.getConnectString())); + conf.set(YarnConfiguration.RM_ZK_ADDRESS, optHostPort + .or((curatorTestingServer == null) ? "" : curatorTestingServer + .getConnectString())); conf.set(YarnConfiguration.ZK_RM_STATE_STORE_PARENT_PATH, workingZnode); store = new ZKRMStateStore();