mirror of https://github.com/apache/lucene.git
SOLR-14077: Hadoop shouldn't need to look for metrics config in user home
Signed-off-by: Kevin Risden <krisden@apache.org>
This commit is contained in:
parent
5f8e65c58f
commit
7a9a6ef79e
|
@ -33,9 +33,6 @@ grant {
|
|||
permission java.io.FilePermission "${junit4.tempDir}${/}*", "read,write,delete";
|
||||
permission java.io.FilePermission "${clover.db.dir}${/}-", "read,write,delete";
|
||||
permission java.io.FilePermission "${tests.linedocsfile}", "read";
|
||||
// hadoop
|
||||
permission java.io.FilePermission "${user.home}${/}hadoop-metrics2.properties", "read";
|
||||
permission java.io.FilePermission "${user.home}${/}hadoop-metrics2-namenode.properties", "read";
|
||||
// DirectoryFactoryTest messes with these (wtf?)
|
||||
permission java.io.FilePermission "/tmp/inst1/conf/solrcore.properties", "read";
|
||||
permission java.io.FilePermission "/path/to/myinst/conf/solrcore.properties", "read";
|
||||
|
|
|
@ -47,6 +47,9 @@ import org.apache.hadoop.hdfs.server.namenode.NameNodeResourceChecker;
|
|||
import org.apache.hadoop.hdfs.server.namenode.ha.HATestUtil;
|
||||
import org.apache.hadoop.http.HttpServer2;
|
||||
import org.apache.hadoop.io.nativeio.NativeIO;
|
||||
import org.apache.hadoop.metrics2.MetricsSystem;
|
||||
import org.apache.hadoop.metrics2.impl.MetricsSystemImpl;
|
||||
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
||||
import org.apache.hadoop.util.DiskChecker;
|
||||
import org.apache.lucene.util.Constants;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
@ -159,6 +162,8 @@ public class HdfsTestUtil {
|
|||
|
||||
if (!HA_TESTING_ENABLED) haTesting = false;
|
||||
|
||||
DefaultMetricsSystem.setInstance(new FakeMetricsSystem());
|
||||
|
||||
Configuration conf = getBasicConfiguration(new Configuration());
|
||||
conf.set("hdfs.minidfs.basedir", dir + File.separator + "hdfsBaseDir");
|
||||
conf.set("dfs.namenode.name.dir", dir + File.separator + "nameNodeNameDir");
|
||||
|
@ -374,4 +379,15 @@ public class HdfsTestUtil {
|
|||
super(pool);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that we don't try to initialize metrics and read files outside
|
||||
* the source tree.
|
||||
*/
|
||||
public static class FakeMetricsSystem extends MetricsSystemImpl {
|
||||
@Override
|
||||
public synchronized MetricsSystem init(String prefix) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue