SOLR-14047: Make sure tests don't pickup other Hadoop installs

Signed-off-by: Kevin Risden <krisden@apache.org>
This commit is contained in:
Kevin Risden 2019-12-11 22:40:22 -05:00
parent 4d5df0e20a
commit 322ed8ce4d
No known key found for this signature in database
GPG Key ID: 040FAE3292C5F73F
2 changed files with 18 additions and 1 deletions

View File

@ -123,7 +123,8 @@ Bug Fixes
Other Changes Other Changes
--------------------- ---------------------
(No changes)
SOLR-14047: Make sure tests don't pickup other Hadoop installs (Kevin Risden)
================== 8.4.0 ================== ================== 8.4.0 ==================

View File

@ -74,11 +74,27 @@ public class HdfsTestUtil {
} }
public static void checkAssumptions() { public static void checkAssumptions() {
ensureHadoopHomeNotSet();
checkHadoopWindows(); checkHadoopWindows();
checkFastDateFormat(); checkFastDateFormat();
checkGeneratedIdMatches(); 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 * Hadoop integration tests fail on Windows without Hadoop NativeIO
*/ */