Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-16408: TestHdfsUpdateLog, TestRecoveryHdfs, and TestRandomCollapseQParserPlugin call SolrTestCaseJ4.teardownTestCases instead of deleteCore (#1003)

Kevin Risden5cbef9e08487
diff --git a/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.java
index 62ac2b2b9b2..2385ceeb035 100644
--- a/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.java
+++ b/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.java
@@ -43,7 +43,7 @@ public class TestRandomCollapseQParserPlugin extends SolrTestCaseJ4 {
public static List<String> ALL_SORT_FIELD_NAMES;
public static List<String> ALL_COLLAPSE_FIELD_NAMES;
- private static String[] NULL_POLICIES =
+ private static final String[] NULL_POLICIES =
new String[] {
CollapsingQParserPlugin.NullPolicy.IGNORE.getName(),
CollapsingQParserPlugin.NullPolicy.COLLAPSE.getName(),
@@ -82,9 +82,9 @@ public class TestRandomCollapseQParserPlugin extends SolrTestCaseJ4 {
@AfterClass
public static void cleanupStatics() {
- deleteCore();
SOLR = null;
- ALL_SORT_FIELD_NAMES = ALL_COLLAPSE_FIELD_NAMES = null;
+ ALL_SORT_FIELD_NAMES = null;
+ ALL_COLLAPSE_FIELD_NAMES = null;
}
public void testEveryIsolatedSortFieldOnSingleGroup() throws Exception {
diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/search/TestRecoveryHdfs.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/search/TestRecoveryHdfs.java
index 739cbe07a79..543f17080dd 100644
--- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/search/TestRecoveryHdfs.java
+++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/search/TestRecoveryHdfs.java
@@ -109,7 +109,8 @@ public class TestRecoveryHdfs extends SolrTestCaseJ4 {
IOUtils.closeQuietly(fs);
fs = null;
try {
- deleteCore();
+ // Make sure to clean up test resources before shutting down HDFS
+ SolrTestCaseJ4.teardownTestCases();
} finally {
try {
HdfsTestUtil.teardownClass(dfsCluster);
@@ -117,8 +118,6 @@ public class TestRecoveryHdfs extends SolrTestCaseJ4 {
dfsCluster = null;
hdfsUri = null;
System.clearProperty("solr.ulog.dir");
- System.clearProperty("test.build.data");
- System.clearProperty("test.cache.data");
}
}
}
diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/update/TestHdfsUpdateLog.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/update/TestHdfsUpdateLog.java
index 154ce5ba97f..4b58b558ec5 100644
--- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/update/TestHdfsUpdateLog.java
+++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/update/TestHdfsUpdateLog.java
@@ -72,7 +72,8 @@ public class TestHdfsUpdateLog extends SolrTestCaseJ4 {
IOUtils.closeQuietly(fs);
fs = null;
try {
- deleteCore();
+ // Make sure to clean up test resources before shutting down HDFS
+ SolrTestCaseJ4.teardownTestCases();
} finally {
try {
HdfsTestUtil.teardownClass(dfsCluster);
@@ -80,8 +81,6 @@ public class TestHdfsUpdateLog extends SolrTestCaseJ4 {
dfsCluster = null;
hdfsUri = null;
System.clearProperty("solr.ulog.dir");
- System.clearProperty("test.build.data");
- System.clearProperty("test.cache.data");
}
}
}