You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kr...@apache.org on 2019/12/12 15:37:15 UTC

[lucene-solr] branch branch_8x updated: SOLR-14047: Make sure tests don't pickup other Hadoop installs

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 85b433e  SOLR-14047: Make sure tests don't pickup other Hadoop installs
85b433e is described below

commit 85b433e277ec91af644b4327e202e391ed536410
Author: Kevin Risden <kr...@apache.org>
AuthorDate: Wed Dec 11 22:40:22 2019 -0500

    SOLR-14047: Make sure tests don't pickup other Hadoop installs
    
    Signed-off-by: Kevin Risden <kr...@apache.org>
---
 solr/CHANGES.txt                                         |  3 ++-
 .../test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java    | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b0d0b0a..a8c1e05 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -50,7 +50,8 @@ Bug Fixes
 
 Other 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.java
index c86db8b..2afee35 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,12 +74,28 @@ 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
    */
   private static void checkHadoopWindows() {