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 03:23:10 UTC

[lucene-solr] 01/02: SOLR-14053: Don't start hdfs when native libraries can't be loaded. Remove tests.disableHdfs. (#1072)

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

commit d6e7898bc901953e6703b9964320bbd92754e976
Author: Dawid Weiss <dw...@apache.org>
AuthorDate: Wed Dec 11 15:01:24 2019 +0100

    SOLR-14053: Don't start hdfs when native libraries can't be loaded. Remove tests.disableHdfs. (#1072)
---
 solr/common-build.xml                                          |  8 --------
 .../core/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java | 10 +++++++---
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/solr/common-build.xml b/solr/common-build.xml
index 8b513b6..d06fa2f 100644
--- a/solr/common-build.xml
+++ b/solr/common-build.xml
@@ -157,14 +157,6 @@
     <istrue value="${tests.useSecurityManager}"/>
   </condition>
 
-  <!--
-    We don't want to run HDFS tests on Windows by default, because they require Cygwin.
-    Cygwin users can explicitly set -Dtests.disableHdfs=false to enable Hdfs related testing.
-  -->
-  <condition property="tests.disableHdfs" value="true">
-    <os family="windows"/>
-  </condition>
-
   <target name="validate" depends="compile-tools">
   </target>
 
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 149d108..f6f6588 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
@@ -38,12 +38,14 @@ import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.MiniDFSNNTopology;
 import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter;
 import org.apache.hadoop.hdfs.server.namenode.ha.HATestUtil;
+import org.apache.hadoop.io.nativeio.NativeIO;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.util.IOUtils;
 import org.apache.solr.common.util.SuppressForbidden;
 import org.apache.solr.core.DirectoryFactory;
 import org.apache.solr.util.HdfsUtil;
+import org.junit.AssumptionViolatedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -94,9 +96,6 @@ public class HdfsTestUtil {
   }
 
   public static MiniDFSCluster setupClass(String dir, boolean safeModeTesting, boolean haTesting) throws Exception {
-    LuceneTestCase.assumeFalse("HDFS tests were disabled by -Dtests.disableHdfs",
-      Boolean.parseBoolean(System.getProperty("tests.disableHdfs", "false")));
-
     checkFastDateFormat();
     checkGeneratedIdMatches();
 
@@ -132,6 +131,11 @@ public class HdfsTestUtil {
     if (haTesting) {
       dfsClusterBuilder.nnTopology(MiniDFSNNTopology.simpleHATopology());
     }
+
+    if (!NativeIO.isAvailable()) {
+      throw new AssumptionViolatedException("NativeIO not available for HDFS.");
+    }
+
     MiniDFSCluster dfsCluster = dfsClusterBuilder.build();
     HdfsUtil.TEST_CONF = getClientConfiguration(dfsCluster);
     System.setProperty("solr.hdfs.home", getDataDir(dfsCluster, "solr_hdfs_home"));