diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java index 5edd3ca342c..68d97ee32ac 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java @@ -313,7 +313,13 @@ public class MiniYARNCluster extends CompositeService { YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED) || enableAHS) { addService(new ApplicationHistoryServerWrapper()); } - + // to ensure that any FileSystemNodeAttributeStore started by the RM always + // uses a unique path, if unset, force it under the test dir. + if (conf.get(YarnConfiguration.FS_NODE_ATTRIBUTE_STORE_ROOT_DIR) == null) { + File nodeAttrDir = new File(getTestWorkDir(), "nodeattributes"); + conf.set(YarnConfiguration.FS_NODE_ATTRIBUTE_STORE_ROOT_DIR, + nodeAttrDir.getCanonicalPath()); + } super.serviceInit( conf instanceof YarnConfiguration ? conf : new YarnConfiguration(conf)); }