This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_10x by this push:
new 7d1cf6604e6 Deal with properties that are needed for ONE test, but
pollute all our tests. (#3987)
7d1cf6604e6 is described below
commit 7d1cf6604e67d7e397cfd5a6cc81d0e7a21f9e59
Author: Eric Pugh <[email protected]>
AuthorDate: Mon Dec 29 10:53:10 2025 -0500
Deal with properties that are needed for ONE test, but pollute all our
tests. (#3987)
This PR addresses test pollution by isolating system property usage that
was only needed by a single test but was being set globally across 33 different
test locations. The solution creates a dedicated test class
TestConfigPropertySubstitution for the one test that actually requires the
solr.test.sys.prop1 and solr.test.sys.prop2 properties, and removes the
unnecessary property setup/teardown from 32 other test locations.
---
.../conf/solrconfig-analytics-query.xml | 4 --
.../conf/solrconfig-collapseqparser.xml | 4 --
.../solr/collection1/conf/solrconfig-elevate.xml | 4 --
.../solr/collection1/conf/solrconfig-minhash.xml | 4 --
.../collection1/conf/solrconfig-plugcollector.xml | 4 --
.../solr/collection1/conf/solrconfig-test-misc.xml | 6 --
...est-misc.xml => solrconfig-test-properties.xml} | 22 +++-----
.../solr/collection1/conf/solrconfig.xml | 4 --
.../apache/solr/cloud/TestRequestForwarding.java | 5 --
.../src/test/org/apache/solr/core/TestConfig.java | 26 ---------
.../solr/core/TestConfigPropertySubstitution.java | 66 ++++++++++++++++++++++
.../apache/solr/core/TestCorePropertiesReload.java | 2 -
.../apache/solr/handler/ReplicationTestHelper.java | 3 -
.../solr/metrics/SolrMetricsIntegrationTest.java | 3 -
.../org/apache/solr/rest/SolrRestletTestBase.java | 3 -
.../test/org/apache/solr/schema/DateFieldTest.java | 3 -
.../apache/solr/schema/PrimitiveFieldTypeTest.java | 2 -
.../solr/search/join/ShardToShardJoinAbstract.java | 19 +------
.../apache/solr/search/stats/TestDistribIDF.java | 5 --
.../test/org/apache/solr/update/RootFieldTest.java | 2 -
.../AbstractAtomicUpdatesMultivalueTestBase.java | 2 -
.../solr/collection1/conf/solrconfig.xml | 3 -
.../apache/solr/BaseDistributedSearchTestCase.java | 2 -
.../java/org/apache/solr/SolrJettyTestBase.java | 3 -
.../src/java/org/apache/solr/SolrTestCaseJ4.java | 4 --
.../solr/cloud/AbstractFullDistribZkTestBase.java | 6 --
.../org/apache/solr/cloud/AbstractZkTestCase.java | 2 -
.../src/java/org/apache/solr/util/TestHarness.java | 3 -
.../solr/collection1/conf/solrconfig.xml | 4 --
29 files changed, 78 insertions(+), 142 deletions(-)
diff --git
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-analytics-query.xml
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-analytics-query.xml
index 455f1987cf2..1012b14a0c8 100644
---
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-analytics-query.xml
+++
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-analytics-query.xml
@@ -217,10 +217,6 @@
</httpCaching>
</requestDispatcher>
- <!-- test getting system property -->
- <propTest attr1="${solr.test.sys.prop1}-$${literal}"
-
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
-
<queryParser name="count"
class="org.apache.solr.search.AnalyticsTestQParserPlugin"/>
<updateRequestProcessorChain name="uniq-fields">
diff --git
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-collapseqparser.xml
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-collapseqparser.xml
index b655c9355da..b346eb08db0 100644
---
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-collapseqparser.xml
+++
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-collapseqparser.xml
@@ -220,10 +220,6 @@
</httpCaching>
</requestDispatcher>
- <!-- test getting system property -->
- <propTest attr1="${solr.test.sys.prop1}-$${literal}"
-
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
-
<queryParser name="foo" class="FooQParserPlugin"/>
<updateRequestProcessorChain name="uniq-fields">
diff --git
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-elevate.xml
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-elevate.xml
index 63bb8f84ffa..7e71e3c76ae 100644
--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-elevate.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-elevate.xml
@@ -120,10 +120,6 @@
</httpCaching>
</requestDispatcher>
- <!-- test getting system property -->
- <propTest attr1="${solr.test.sys.prop1}-$${literal}"
-
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
-
<queryParser name="foo" class="FooQParserPlugin"/>
<initParams path="/elevate,/dataElevate">
diff --git
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-minhash.xml
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-minhash.xml
index abd50a7cbf0..8d6e8e842b8 100644
--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-minhash.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-minhash.xml
@@ -434,10 +434,6 @@
</lst>
</requestHandler>
- <!-- test getting system property -->
- <propTest attr1="${solr.test.sys.prop1}-$${literal}"
-
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
-
<queryParser name="foo" class="FooQParserPlugin"/>
<updateRequestProcessorChain name="uniq-fields">
diff --git
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-plugcollector.xml
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-plugcollector.xml
index c7e160d8980..f543311b856 100644
---
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-plugcollector.xml
+++
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-plugcollector.xml
@@ -430,10 +430,6 @@
</httpCaching>
</requestDispatcher>
- <!-- test getting system property -->
- <propTest attr1="${solr.test.sys.prop1}-$${literal}"
-
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
-
<queryParser name="rank" class="org.apache.solr.search.RankQueryTestPlugin"/>
<updateRequestProcessorChain name="uniq-fields">
diff --git
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-test-misc.xml
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-test-misc.xml
index cbfe9752574..f26744ad177 100644
--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-test-misc.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-test-misc.xml
@@ -28,14 +28,8 @@
<directoryFactory name="DirectoryFactory"
class="${solr.directoryFactory:solr.MockDirectoryFactory}"/>
<schemaFactory class="ClassicIndexSchemaFactory"/>
- <!-- see TestConfig.testJavaProperty -->
- <propTest attr1="${solr.test.sys.prop1}-$${literal}"
-
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
-
<!-- see TestConfig.testDisableRequetsHandler -->
<requestHandler name="/disabled" class="solr.SearchHandler" enable="false"/>
<requestHandler name="/enabled" class="solr.SearchHandler" enable="true"/>
-
-
</config>
diff --git
a/solr/core/src/test-files/solr/collection1/conf/solrconfig-test-misc.xml
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-test-properties.xml
similarity index 74%
copy from
solr/core/src/test-files/solr/collection1/conf/solrconfig-test-misc.xml
copy to
solr/core/src/test-files/solr/collection1/conf/solrconfig-test-properties.xml
index cbfe9752574..2a095e0b02a 100644
--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-test-misc.xml
+++
b/solr/core/src/test-files/solr/collection1/conf/solrconfig-test-properties.xml
@@ -17,25 +17,21 @@
limitations under the License.
-->
-<!-- used by TestConfig to tests a few misc things relating to:
- * lib dirs
- * property substitution
- * "gettableFiles" option
+<!--
+ A minimal solrconfig specifically for testing property substitution
functionality.
+ This config is used by
TestConfigPropertySubstitution.testJavaPropertySubstitution() to test
+ that system property substitution works correctly in Solr configuration
files.
-->
<config>
<luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>
+ <dataDir>${solr.data.dir:}</dataDir>
<xi:include href="solrconfig.snippet.randomindexconfig.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"/>
<directoryFactory name="DirectoryFactory"
class="${solr.directoryFactory:solr.MockDirectoryFactory}"/>
<schemaFactory class="ClassicIndexSchemaFactory"/>
-
- <!-- see TestConfig.testJavaProperty -->
+
+ <!-- This element is specifically for testing property substitution -->
<propTest attr1="${solr.test.sys.prop1}-$${literal}"
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
- <!-- see TestConfig.testDisableRequetsHandler -->
- <requestHandler name="/disabled" class="solr.SearchHandler" enable="false"/>
- <requestHandler name="/enabled" class="solr.SearchHandler" enable="true"/>
-
-
-
-</config>
+ <requestHandler name="/select" class="solr.SearchHandler" />
+</config>
\ No newline at end of file
diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig.xml
b/solr/core/src/test-files/solr/collection1/conf/solrconfig.xml
index 30764a94377..9efa5d4a29c 100644
--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig.xml
@@ -467,10 +467,6 @@
</lst>
</requestHandler>
- <!-- test getting system property -->
- <propTest attr1="${solr.test.sys.prop1}-$${literal}"
-
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
-
<queryParser name="foo" class="FooQParserPlugin"/>
<updateRequestProcessorChain name="uniq-fields">
diff --git
a/solr/core/src/test/org/apache/solr/cloud/TestRequestForwarding.java
b/solr/core/src/test/org/apache/solr/cloud/TestRequestForwarding.java
index c672da3f4f2..1bb0816aa34 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestRequestForwarding.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestRequestForwarding.java
@@ -35,8 +35,6 @@ public class TestRequestForwarding extends SolrTestCaseJ4 {
@Override
public void setUp() throws Exception {
super.setUp();
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
solrCluster = new MiniSolrCloudCluster(3, createTempDir(),
JettyConfig.builder().build());
solrCluster.uploadConfigSet(TEST_PATH().resolve("collection1/conf"),
"conf1");
}
@@ -44,9 +42,6 @@ public class TestRequestForwarding extends SolrTestCaseJ4 {
@Override
public void tearDown() throws Exception {
solrCluster.shutdown();
- System.clearProperty("solr.test.sys.prop1");
- System.clearProperty("solr.test.sys.prop2");
-
super.tearDown();
}
diff --git a/solr/core/src/test/org/apache/solr/core/TestConfig.java
b/solr/core/src/test/org/apache/solr/core/TestConfig.java
index 745fa21c4c5..a785b3c731b 100644
--- a/solr/core/src/test/org/apache/solr/core/TestConfig.java
+++ b/solr/core/src/test/org/apache/solr/core/TestConfig.java
@@ -20,13 +20,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.LinkedHashMap;
-import java.util.List;
import org.apache.lucene.index.ConcurrentMergeScheduler;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.TieredMergePolicy;
import org.apache.lucene.util.InfoStream;
import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.common.ConfigNode;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.IndexSchemaFactory;
import org.apache.solr.search.CacheConfig;
@@ -63,30 +61,6 @@ public class TestConfig extends SolrTestCaseJ4 {
assertNotNull(h.getCore().getRequestHandler("/enabled"));
}
- @Test
- public void testJavaProperty() {
- // property values defined in build.xml
-
- String s = solrConfig.get("propTest").txt();
- assertEquals("prefix-proptwo-suffix", s);
-
- s = solrConfig.get("propTest").attr("attr1", "default");
- assertEquals("propone-${literal}", s);
-
- s = solrConfig.get("propTest").attr("attr2", "default");
- assertEquals("default-from-config", s);
-
- assertEquals(
- "prefix-proptwo-suffix",
- solrConfig.get("propTest", it ->
"default-from-config".equals(it.attr("attr2"))).txt());
-
- List<ConfigNode> nl = solrConfig.root.getAll("propTest");
- assertEquals(1, nl.size());
- assertEquals("prefix-proptwo-suffix", nl.get(0).txt());
-
- assertEquals("prefix-proptwo-suffix", solrConfig.get("propTest").txt());
- }
-
@Test
public void testCacheEnablingDisabling() throws Exception {
// ensure if cache is not defined in the config then cache is disabled
diff --git
a/solr/core/src/test/org/apache/solr/core/TestConfigPropertySubstitution.java
b/solr/core/src/test/org/apache/solr/core/TestConfigPropertySubstitution.java
new file mode 100644
index 00000000000..e40c1d09e70
--- /dev/null
+++
b/solr/core/src/test/org/apache/solr/core/TestConfigPropertySubstitution.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.core;
+
+import java.util.List;
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.ConfigNode;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test class specifically for testing system property substitution in Solr
configuration files.
+ * This class is isolated from other tests to minimize the global impact of
setting test-specific
+ * system properties.
+ */
+public class TestConfigPropertySubstitution extends SolrTestCaseJ4 {
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ // Set the test properties specifically for property substitution testing
+ System.setProperty("solr.test.sys.prop1", "propone");
+ System.setProperty("solr.test.sys.prop2", "proptwo");
+
+ // Use a minimal configuration file that only contains the propTest element
+ initCore("solrconfig-test-properties.xml", "schema.xml");
+ }
+
+ @Test
+ public void testJavaPropertySubstitution() {
+ // Test that system property substitution works correctly in configuration
files
+ // These property values are set in beforeClass()
+
+ String s = solrConfig.get("propTest").txt();
+ assertEquals("prefix-proptwo-suffix", s);
+
+ s = solrConfig.get("propTest").attr("attr1", "default");
+ assertEquals("propone-${literal}", s);
+
+ s = solrConfig.get("propTest").attr("attr2", "default");
+ assertEquals("default-from-config", s);
+
+ assertEquals(
+ "prefix-proptwo-suffix",
+ solrConfig.get("propTest", it ->
"default-from-config".equals(it.attr("attr2"))).txt());
+
+ List<ConfigNode> nl = solrConfig.root.getAll("propTest");
+ assertEquals(1, nl.size());
+ assertEquals("prefix-proptwo-suffix", nl.get(0).txt());
+
+ assertEquals("prefix-proptwo-suffix", solrConfig.get("propTest").txt());
+ }
+}
diff --git
a/solr/core/src/test/org/apache/solr/core/TestCorePropertiesReload.java
b/solr/core/src/test/org/apache/solr/core/TestCorePropertiesReload.java
index f84a00e45d8..fd0e16b504c 100644
--- a/solr/core/src/test/org/apache/solr/core/TestCorePropertiesReload.java
+++ b/solr/core/src/test/org/apache/solr/core/TestCorePropertiesReload.java
@@ -37,8 +37,6 @@ public class TestCorePropertiesReload extends SolrTestCaseJ4 {
solrHomeDirectory = createTempDir();
PathUtils.copyDirectory(TEST_HOME(), solrHomeDirectory);
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
Properties props = new Properties();
props.setProperty("test", "Before reload");
writeCustomProperties(props);
diff --git
a/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java
b/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java
index 0a25972f7ac..a5eace8426d 100644
--- a/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java
+++ b/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java
@@ -292,9 +292,6 @@ public final class ReplicationTestHelper {
}
public void setUp() throws Exception {
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
-
Properties props = new Properties();
props.setProperty("name", "collection1");
diff --git
a/solr/core/src/test/org/apache/solr/metrics/SolrMetricsIntegrationTest.java
b/solr/core/src/test/org/apache/solr/metrics/SolrMetricsIntegrationTest.java
index dd599e1f1b4..ecfaf52451a 100644
--- a/solr/core/src/test/org/apache/solr/metrics/SolrMetricsIntegrationTest.java
+++ b/solr/core/src/test/org/apache/solr/metrics/SolrMetricsIntegrationTest.java
@@ -50,9 +50,6 @@ public class SolrMetricsIntegrationTest extends
SolrTestCaseJ4 {
@Before
public void beforeTest() throws Exception {
Path home = TEST_PATH();
- // define these properties, they are used in solrconfig.xml
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
String solrXml =
Files.readString(home.resolve("solr-metricreporter.xml"),
StandardCharsets.UTF_8);
NodeConfig cfg = SolrXmlConfig.fromString(home, solrXml);
diff --git a/solr/core/src/test/org/apache/solr/rest/SolrRestletTestBase.java
b/solr/core/src/test/org/apache/solr/rest/SolrRestletTestBase.java
index 9289b33447e..a6b6f909d2b 100644
--- a/solr/core/src/test/org/apache/solr/rest/SolrRestletTestBase.java
+++ b/solr/core/src/test/org/apache/solr/rest/SolrRestletTestBase.java
@@ -46,9 +46,6 @@ public abstract class SolrRestletTestBase extends
RestTestBase {
System.setProperty("coreRootDirectory", coresDir.toString());
System.setProperty("configSetBaseDir", TEST_HOME().toString());
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
-
final SortedMap<ServletHolder, String> extraServlets = new TreeMap<>();
Properties props = new Properties();
diff --git a/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java
b/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java
index 3db98117565..fb50c88578f 100644
--- a/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java
+++ b/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java
@@ -32,9 +32,6 @@ public class DateFieldTest extends SolrTestCaseJ4 {
@Override
public void setUp() throws Exception {
super.setUp();
- // set some system properties for use by tests
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
SolrConfig config =
new SolrConfig(testInstanceDir,
testConfHome.resolve("solrconfig.xml").toString());
IndexSchema schema =
diff --git
a/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java
b/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java
index 5b681d4c9fc..4b5dfc76b99 100644
--- a/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java
+++ b/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java
@@ -38,8 +38,6 @@ public class PrimitiveFieldTypeTest extends SolrTestCaseJ4 {
// set some system properties for use by tests
System.setProperty(
"solr.index.updatelog.enabled", "false"); // schema12 doesn't support
_version_
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
initMap = new HashMap<>();
config =
diff --git
a/solr/core/src/test/org/apache/solr/search/join/ShardToShardJoinAbstract.java
b/solr/core/src/test/org/apache/solr/search/join/ShardToShardJoinAbstract.java
index b2b3f4be01e..5790027afcf 100644
---
a/solr/core/src/test/org/apache/solr/search/join/ShardToShardJoinAbstract.java
+++
b/solr/core/src/test/org/apache/solr/search/join/ShardToShardJoinAbstract.java
@@ -20,7 +20,6 @@ import static java.util.Collections.singletonMap;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
-import java.nio.file.Path;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
@@ -43,7 +42,6 @@ import org.apache.solr.client.solrj.request.V2Request;
import org.apache.solr.client.solrj.request.beans.PluginMeta;
import org.apache.solr.client.solrj.response.CollectionAdminResponse;
import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.cloud.MiniSolrCloudCluster;
import org.apache.solr.cloud.SolrCloudTestCase;
import org.apache.solr.cluster.placement.PlacementPluginFactory;
import org.apache.solr.cluster.placement.plugins.AffinityPlacementConfig;
@@ -52,13 +50,12 @@ import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrInputDocument;
import org.junit.AfterClass;
-import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** Tests using fromIndex that points to a collection in SolrCloud mode. */
// @LogLevel("org.apache.solr.schema.IndexSchema=TRACE")
-public class ShardToShardJoinAbstract extends SolrCloudTestCase {
+public abstract class ShardToShardJoinAbstract extends SolrCloudTestCase {
private static final Logger log =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -68,25 +65,17 @@ public class ShardToShardJoinAbstract extends
SolrCloudTestCase {
protected static String toColl = "parent";
protected static String fromColl = "children";
- @BeforeClass
- public static void setPropos() {
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
- }
-
public static void setupCluster(
Consumer<CollectionAdminRequest.Create> fromDecorator,
Consumer<CollectionAdminRequest.Create> parentDecorator,
Function<String, SolrInputDocument> parentDocFactory,
BiFunction<String, String, SolrInputDocument> childDocFactory)
throws Exception {
- final Path configDir = TEST_COLL1_CONF();
String configName = "_default"; // "solrCloudCollectionConfig";
int nodeCount = 5;
- final MiniSolrCloudCluster cloudCluster =
- configureCluster(nodeCount) // .addConfig(configName, configDir)
- .configure();
+
+ configureCluster(nodeCount).configure();
PluginMeta plugin = new PluginMeta();
plugin.name = PlacementPluginFactory.PLUGIN_NAME;
@@ -151,8 +140,6 @@ public class ShardToShardJoinAbstract extends
SolrCloudTestCase {
@AfterClass
public static void shutdown() {
- System.clearProperty("solr.test.sys.prop1");
- System.clearProperty("solr.test.sys.prop2");
log.info("logic complete ... deleting the {} and {} collections", toColl,
fromColl);
// try to clean up
diff --git
a/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
b/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
index 2bcd27d87e4..9a7e758a6a5 100644
--- a/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
+++ b/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
@@ -55,9 +55,6 @@ public class TestDistribIDF extends SolrTestCaseJ4 {
super.setUp();
solrCluster = new MiniSolrCloudCluster(3, createTempDir(),
JettyConfig.builder().build());
- // set some system properties for use by tests
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
solrCluster.uploadConfigSet(TEST_PATH().resolve("collection1/conf"),
"conf1");
solrCluster.uploadConfigSet(configset("configset-2"), "conf2");
}
@@ -66,8 +63,6 @@ public class TestDistribIDF extends SolrTestCaseJ4 {
public void tearDown() throws Exception {
solrCluster.shutdown();
System.clearProperty("solr.statsCache");
- System.clearProperty("solr.test.sys.prop1");
- System.clearProperty("solr.test.sys.prop2");
super.tearDown();
}
diff --git a/solr/core/src/test/org/apache/solr/update/RootFieldTest.java
b/solr/core/src/test/org/apache/solr/update/RootFieldTest.java
index c553e58322c..1c436829d24 100644
--- a/solr/core/src/test/org/apache/solr/update/RootFieldTest.java
+++ b/solr/core/src/test/org/apache/solr/update/RootFieldTest.java
@@ -56,8 +56,6 @@ public class RootFieldTest extends EmbeddedSolrServerTestBase
{
// schema15.xml declares _root_ field, while schema-rest.xml does not.
String schema = useRootSchema ? "schema15.xml" : "schema-rest.xml";
SolrTestCaseJ4.newRandomConfig();
- System.setProperty("solr.test.sys.prop1", "propone"); // TODO yuck; remove
- System.setProperty("solr.test.sys.prop2", "proptwo"); // TODO yuck; remove
solrClientTestRule
.newCollection()
diff --git
a/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java
b/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java
index 75cb9b69327..a4bdac64b11 100644
---
a/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java
+++
b/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java
@@ -49,8 +49,6 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase
extends EmbeddedSo
System.setProperty("solr.index.updatelog.enabled", "true");
SolrTestCaseJ4.newRandomConfig();
- System.setProperty("solr.test.sys.prop1", "propone"); // TODO yuck; remove
- System.setProperty("solr.test.sys.prop2", "proptwo"); // TODO yuck; remove
solrClientTestRule.newCollection().withConfigSet("../collection1").create();
}
diff --git
a/solr/modules/extraction/src/test-files/extraction/solr/collection1/conf/solrconfig.xml
b/solr/modules/extraction/src/test-files/extraction/solr/collection1/conf/solrconfig.xml
index 159d5e16162..4ed11e82fe6 100644
---
a/solr/modules/extraction/src/test-files/extraction/solr/collection1/conf/solrconfig.xml
+++
b/solr/modules/extraction/src/test-files/extraction/solr/collection1/conf/solrconfig.xml
@@ -203,8 +203,5 @@
</httpCaching>
</requestDispatcher>
- <!-- test getting system property -->
- <propTest attr1="${solr.test.sys.prop1}-$${literal}"
-
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
</config>
diff --git
a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
index 465c771ee2c..726c736fda7 100644
---
a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
+++
b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
@@ -257,8 +257,6 @@ public abstract class BaseDistributedSearchTestCase extends
SolrTestCaseJ4 {
public void distribSetUp() throws Exception {
distribSetUpCalled = true;
SolrTestCaseJ4.resetExceptionIgnores(); // ignore anything with
ignore_exception in it
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
testDir = createTempDir();
}
diff --git
a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
index 93e5424c824..a6524e74800 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
@@ -134,9 +134,6 @@ public abstract class SolrJettyTestBase extends
SolrTestCaseJ4 {
// explicitly there as of SOLR-4817
@Deprecated // Instead use a basic config + whatever is needed or default
config
protected static void setupJettyTestHome(Path solrHome, String collection)
throws Exception {
- // TODO remove these sys props!
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
copySolrHomeToTemp(solrHome, collection);
}
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
index 2036a94ce61..26c21b60007 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
@@ -704,10 +704,6 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
ignoreException("ignore_exception");
- // other methods like starting a jetty instance need these too
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
-
String configFile = getSolrConfigFile();
if (configFile != null) {
createCore();
diff --git
a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
index 67922db5a42..82bae1ea2f4 100644
---
a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
+++
b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
@@ -276,10 +276,6 @@ public abstract class AbstractFullDistribZkTestBase
extends BaseDistributedSearc
if (schema == null) schema = "schema.xml";
zkServer.buildZooKeeper(getCloudSolrConfig(), schema);
- // set some system properties for use by tests
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
-
// ignoreException(".*");
cloudInit = false;
@@ -2211,8 +2207,6 @@ public abstract class AbstractFullDistribZkTestBase
extends BaseDistributedSearc
System.clearProperty(ENABLE_UPDATE_LOG);
System.clearProperty(REMOVE_VERSION_FIELD);
System.clearProperty("solr.directoryFactory");
- System.clearProperty("solr.test.sys.prop1");
- System.clearProperty("solr.test.sys.prop2");
System.clearProperty(ZOOKEEPER_FORCE_SYNC);
System.clearProperty(
MockDirectoryFactory.SOLR_TESTS_ALLOW_READING_FILES_STILL_OPEN_FOR_WRITE);
diff --git
a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java
b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java
index 2c423d3f973..43100f63c08 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java
@@ -72,8 +72,6 @@ public abstract class AbstractZkTestCase extends
SolrTestCaseJ4 {
} finally {
System.clearProperty("zkHost");
- System.clearProperty("solr.test.sys.prop1");
- System.clearProperty("solr.test.sys.prop2");
System.clearProperty("solrcloud.skip.autorecovery");
System.clearProperty("solr.port.listen");
System.clearProperty(ZOOKEEPER_FORCE_SYNC);
diff --git a/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
b/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
index c363a1e635d..29caa318a04 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
@@ -67,9 +67,6 @@ public class TestHarness extends BaseTestHarness {
* ${solrHome}/${coreName}/conf/${confFile}</code>
*/
public static SolrConfig createConfig(Path solrHome, String coreName, String
confFile) {
- // set some system properties for use by tests
- System.setProperty("solr.test.sys.prop1", "propone");
- System.setProperty("solr.test.sys.prop2", "proptwo");
try {
return new SolrConfig(solrHome.resolve(coreName), confFile);
} catch (Exception xany) {
diff --git
a/solr/test-framework/src/test-files/solr/collection1/conf/solrconfig.xml
b/solr/test-framework/src/test-files/solr/collection1/conf/solrconfig.xml
index 4338f0cf40a..a91253e1b0b 100644
--- a/solr/test-framework/src/test-files/solr/collection1/conf/solrconfig.xml
+++ b/solr/test-framework/src/test-files/solr/collection1/conf/solrconfig.xml
@@ -452,10 +452,6 @@
</lst>
</requestHandler>
- <!-- test getting system property -->
- <propTest attr1="${solr.test.sys.prop1}-$${literal}"
-
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
-
<queryParser name="foo" class="FooQParserPlugin"/>
<updateRequestProcessorChain name="uniq-fields">