Apache Solr open-source search software
SOLR-14047: Make sure tests don't pickup other Hadoop installs
Kevin Risden322ed8ce4d87
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 04f6eacbcf3..0e26813aeab 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -123,7 +123,8 @@ Bug FixesOther Changes----------------------(No changes)++SOLR-14047: Make sure tests don't pickup other Hadoop installs (Kevin Risden)================== 8.4.0 ==================diff --git a/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java b/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.javaindex c86db8b5e5f..2afee3598c6 100644--- a/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java+++ b/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java@@ -74,11 +74,27 @@ public class HdfsTestUtil {}public static void checkAssumptions() {+ ensureHadoopHomeNotSet();checkHadoopWindows();checkFastDateFormat();checkGeneratedIdMatches();}+ /**+ * If Hadoop home is set via environment variable HADOOP_HOME or Java system property+ * hadoop.home.dir, the behavior of test is undefined. Ensure that these are not set+ * before starting. It is not possible to easily unset environment variables so better+ * to bail out early instead of trying to test.+ */+ private static void ensureHadoopHomeNotSet() {+ if (System.getenv("HADOOP_HOME") != null) {+ LuceneTestCase.fail("Ensure that HADOOP_HOME environment variable is not set.");+ }+ if (System.getProperty("hadoop.home.dir") != null) {+ LuceneTestCase.fail("Ensure that \"hadoop.home.dir\" Java property is not set.");+ }+ }+/*** Hadoop integration tests fail on Windows without Hadoop NativeIO*/