mirror of https://github.com/apache/lucene.git
SOLR-8674: solr.tests.mergePolicy[Factory] tests now randomly choose between <mergePolicy> and <mergePolicyFactory>
* This increases <mergePolicy> vs. <mergePolicyFactory> test coverage. * This temporarily also adds a little test setup complexity but when SOLR-8668 removes support for <mergePolicy> then test setup will return to its original complexity.
This commit is contained in:
parent
fa602bf635
commit
b14fb50b7f
|
@ -26,7 +26,7 @@ A solrconfig.xml snippet containing indexConfig settings for randomized testing.
|
|||
the RandomMergePolicy in all tests - but some tests expect very specific
|
||||
Merge behavior, so those tests can set it as needed.
|
||||
-->
|
||||
<mergePolicy class="${solr.tests.mergePolicy:org.apache.solr.util.RandomMergePolicy}" />
|
||||
<mergePolicyFactory class="${solr.tests.mergePolicyFactory:org.apache.solr.util.RandomMergePolicyFactory}" />
|
||||
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
to configure an explicit deletion policy, but we still wnat to randomize as much
|
||||
as possible.
|
||||
-->
|
||||
<mergePolicy class="${solr.tests.mergePolicy:org.apache.solr.util.RandomMergePolicy}" />
|
||||
<mergePolicy enable="${solr.tests.useMergePolicy:true}" class="${solr.tests.mergePolicy:org.apache.solr.util.RandomMergePolicy}" />
|
||||
<mergePolicyFactory enable="${solr.tests.useMergePolicyFactory:true}" class="${solr.tests.mergePolicyFactory:org.apache.solr.util.RandomMergePolicyFactory}" />
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
|
||||
<maxBufferedDocs>${solr.tests.maxBufferedDocs}</maxBufferedDocs>
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
to configure an explicit deletion policy, but we still wnat to randomize as much
|
||||
as possible.
|
||||
-->
|
||||
<mergePolicy class="${solr.tests.mergePolicy:org.apache.solr.util.RandomMergePolicy}" />
|
||||
<mergePolicy enable="${solr.tests.useMergePolicy:true}" class="${solr.tests.mergePolicy:org.apache.solr.util.RandomMergePolicy}" />
|
||||
<mergePolicyFactory enable="${solr.tests.useMergePolicyFactory:true}" class="${solr.tests.mergePolicyFactory:org.apache.solr.util.RandomMergePolicyFactory}" />
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
|
||||
<maxBufferedDocs>${solr.tests.maxBufferedDocs}</maxBufferedDocs>
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
<config>
|
||||
<luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>
|
||||
<indexConfig>
|
||||
<mergePolicy class="${solr.tests.mergePolicy:org.apache.solr.util.RandomMergePolicy}" />
|
||||
<mergePolicy enable="${solr.tests.useMergePolicy:true}" class="${solr.tests.mergePolicy:org.apache.solr.util.RandomMergePolicy}" />
|
||||
<mergePolicyFactory enable="${solr.tests.useMergePolicyFactory:true}" class="${solr.tests.mergePolicyFactory:org.apache.solr.util.RandomMergePolicyFactory}" />
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
<maxBufferedDocs>${solr.tests.maxBufferedDocs}</maxBufferedDocs>
|
||||
<ramBufferSizeMB>${solr.tests.ramBufferSizeMB}</ramBufferSizeMB>
|
||||
|
|
|
@ -26,7 +26,8 @@ A solrconfig.xml snippet containing indexConfig settings for randomized testing.
|
|||
the RandomMergePolicy in all tests - but some tests expect very specific
|
||||
Merge behavior, so those tests can set it as needed.
|
||||
-->
|
||||
<mergePolicyFactory class="org.apache.solr.util.RandomMergePolicyFactory" />
|
||||
<mergePolicy enable="${solr.tests.useMergePolicy:true}" class="${solr.tests.mergePolicy:org.apache.solr.util.RandomMergePolicy}" />
|
||||
<mergePolicyFactory enable="${solr.tests.useMergePolicyFactory:true}" class="${solr.tests.mergePolicyFactory:org.apache.solr.util.RandomMergePolicyFactory}" />
|
||||
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
|
||||
|
|
|
@ -34,12 +34,14 @@ import org.apache.lucene.index.LogDocMergePolicy;
|
|||
import org.apache.solr.client.solrj.impl.BinaryResponseParser;
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
import org.apache.solr.common.params.GroupParams;
|
||||
import org.apache.solr.index.LogDocMergePolicyFactory;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.request.SolrRequestInfo;
|
||||
import org.apache.solr.response.BinaryResponseWriter;
|
||||
import org.apache.solr.response.ResultContext;
|
||||
import org.apache.solr.response.SolrQueryResponse;
|
||||
import org.apache.solr.schema.IndexSchema;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -61,13 +63,19 @@ public class TestGroupingSearch extends SolrTestCaseJ4 {
|
|||
public static void beforeTests() throws Exception {
|
||||
// force LogDocMergePolicy so that we get a predictable doc order
|
||||
// when doing unsorted group collection
|
||||
System.setProperty("solr.tests.mergePolicy",
|
||||
LogDocMergePolicy.class.getName());
|
||||
systemSetPropertySolrTestsMergePolicy(LogDocMergePolicy.class.getName());
|
||||
systemSetPropertySolrTestsMergePolicyFactory(LogDocMergePolicyFactory.class.getName());
|
||||
|
||||
System.setProperty("enable.update.log", "false"); // schema12 doesn't support _version_
|
||||
initCore("solrconfig.xml", "schema12.xml");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterTests() {
|
||||
systemClearPropertySolrTestsMergePolicy();
|
||||
systemClearPropertySolrTestsMergePolicyFactory();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void cleanIndex() {
|
||||
assertU(delQ("*:*"));
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
|
||||
import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
|
||||
|
||||
import org.apache.lucene.index.TieredMergePolicy;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks;
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
|
@ -48,6 +49,7 @@ import org.apache.solr.common.cloud.Slice;
|
|||
import org.apache.solr.common.cloud.SolrZkClient;
|
||||
import org.apache.solr.common.cloud.ZkStateReader;
|
||||
import org.apache.solr.core.CoreDescriptor;
|
||||
import org.apache.solr.index.TieredMergePolicyFactory;
|
||||
import org.apache.solr.util.RevertDefaultThreadHandlerRule;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
|
@ -105,7 +107,15 @@ public class TestMiniSolrCloudCluster extends LuceneTestCase {
|
|||
collectionProperties.putIfAbsent("solr.tests.maxBufferedDocs", "100000");
|
||||
collectionProperties.putIfAbsent("solr.tests.ramBufferSizeMB", "100");
|
||||
// use non-test classes so RandomizedRunner isn't necessary
|
||||
collectionProperties.putIfAbsent("solr.tests.mergePolicy", "org.apache.lucene.index.TieredMergePolicy");
|
||||
if (random().nextBoolean()) {
|
||||
collectionProperties.putIfAbsent(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICY, TieredMergePolicy.class.getName());
|
||||
collectionProperties.putIfAbsent(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICY, "true");
|
||||
collectionProperties.putIfAbsent(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICYFACTORY, "false");
|
||||
} else {
|
||||
collectionProperties.putIfAbsent(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY, TieredMergePolicyFactory.class.getName());
|
||||
collectionProperties.putIfAbsent(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICYFACTORY, "true");
|
||||
collectionProperties.putIfAbsent(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICY, "false");
|
||||
}
|
||||
collectionProperties.putIfAbsent("solr.tests.mergeScheduler", "org.apache.lucene.index.ConcurrentMergeScheduler");
|
||||
collectionProperties.putIfAbsent("solr.directoryFactory", (persistIndex ? "solr.StandardDirectoryFactory" : "solr.RAMDirectoryFactory"));
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
|
||||
import org.apache.lucene.index.TieredMergePolicy;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.apache.solr.client.solrj.SolrQuery;
|
||||
|
@ -39,6 +40,7 @@ import org.apache.solr.common.cloud.Slice;
|
|||
import org.apache.solr.common.cloud.SolrZkClient;
|
||||
import org.apache.solr.common.cloud.ZkStateReader;
|
||||
import org.apache.solr.core.CoreDescriptor;
|
||||
import org.apache.solr.index.TieredMergePolicyFactory;
|
||||
import org.apache.solr.util.RevertDefaultThreadHandlerRule;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
|
@ -93,7 +95,15 @@ public class TestMiniSolrCloudClusterBase extends LuceneTestCase {
|
|||
collectionProperties.put("solr.tests.maxBufferedDocs", "100000");
|
||||
collectionProperties.put("solr.tests.ramBufferSizeMB", "100");
|
||||
// use non-test classes so RandomizedRunner isn't necessary
|
||||
collectionProperties.put("solr.tests.mergePolicy", "org.apache.lucene.index.TieredMergePolicy");
|
||||
if (random().nextBoolean()) {
|
||||
collectionProperties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICY, TieredMergePolicy.class.getName());
|
||||
collectionProperties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICY, "true");
|
||||
collectionProperties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICYFACTORY, "false");
|
||||
} else {
|
||||
collectionProperties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY, TieredMergePolicyFactory.class.getName());
|
||||
collectionProperties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICYFACTORY, "true");
|
||||
collectionProperties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICY, "false");
|
||||
}
|
||||
collectionProperties.put("solr.tests.mergeScheduler", "org.apache.lucene.index.ConcurrentMergeScheduler");
|
||||
collectionProperties.put("solr.directoryFactory", "solr.RAMDirectoryFactory");
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
|
|||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.hadoop.minikdc.MiniKdc;
|
||||
import org.apache.lucene.index.TieredMergePolicy;
|
||||
import org.apache.lucene.util.Constants;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
|
@ -43,6 +44,7 @@ import org.apache.solr.common.SolrInputDocument;
|
|||
import org.apache.solr.common.cloud.SolrZkClient;
|
||||
import org.apache.solr.common.cloud.ZkStateReader;
|
||||
import org.apache.solr.core.CoreDescriptor;
|
||||
import org.apache.solr.index.TieredMergePolicyFactory;
|
||||
import org.apache.solr.util.BadZookeeperThreadsFilter;
|
||||
import org.apache.solr.util.RevertDefaultThreadHandlerRule;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -185,7 +187,15 @@ public class TestSolrCloudWithKerberosAlt extends LuceneTestCase {
|
|||
properties.put("solr.tests.maxBufferedDocs", "100000");
|
||||
properties.put("solr.tests.ramBufferSizeMB", "100");
|
||||
// use non-test classes so RandomizedRunner isn't necessary
|
||||
properties.put("solr.tests.mergePolicy", "org.apache.lucene.index.TieredMergePolicy");
|
||||
if (random().nextBoolean()) {
|
||||
properties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICY, TieredMergePolicy.class.getName());
|
||||
properties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICY, "true");
|
||||
properties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICYFACTORY, "false");
|
||||
} else {
|
||||
properties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY, TieredMergePolicyFactory.class.getName());
|
||||
properties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICYFACTORY, "true");
|
||||
properties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICY, "false");
|
||||
}
|
||||
properties.put("solr.tests.mergeScheduler", "org.apache.lucene.index.ConcurrentMergeScheduler");
|
||||
properties.put("solr.directoryFactory", "solr.RAMDirectoryFactory");
|
||||
createRequest.setProperties(properties);
|
||||
|
|
|
@ -23,7 +23,9 @@ import java.util.Set;
|
|||
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.apache.lucene.index.LogDocMergePolicy;
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.apache.solr.index.LogDocMergePolicyFactory;
|
||||
import org.apache.solr.search.SolrIndexSearcher;
|
||||
import org.apache.solr.util.RefCounted;
|
||||
import org.junit.AfterClass;
|
||||
|
@ -39,7 +41,8 @@ public class TestNRTOpen extends SolrTestCaseJ4 {
|
|||
System.setProperty("solr.test.leavedatadir", "true");
|
||||
// set these so that merges won't break the test
|
||||
System.setProperty("solr.tests.maxBufferedDocs", "100000");
|
||||
System.setProperty("solr.tests.mergePolicy", "org.apache.lucene.index.LogDocMergePolicy");
|
||||
systemSetPropertySolrTestsMergePolicy(LogDocMergePolicy.class.getName());
|
||||
systemSetPropertySolrTestsMergePolicyFactory(LogDocMergePolicyFactory.class.getName());
|
||||
initCore("solrconfig-basic.xml", "schema-minimal.xml");
|
||||
// add a doc
|
||||
assertU(adoc("foo", "bar"));
|
||||
|
@ -59,7 +62,8 @@ public class TestNRTOpen extends SolrTestCaseJ4 {
|
|||
System.clearProperty("solr.test.leavedatadir");
|
||||
System.clearProperty("solr.directoryFactory");
|
||||
System.clearProperty("solr.tests.maxBufferedDocs");
|
||||
System.clearProperty("solr.tests.mergePolicy");
|
||||
systemClearPropertySolrTestsMergePolicy();
|
||||
systemClearPropertySolrTestsMergePolicyFactory();
|
||||
}
|
||||
|
||||
public void setUp() throws Exception {
|
||||
|
|
|
@ -42,11 +42,13 @@ import org.apache.solr.core.SolrCore;
|
|||
import org.apache.solr.core.SolrEventListener;
|
||||
import org.apache.solr.handler.component.ResponseBuilder;
|
||||
import org.apache.solr.handler.component.SearchComponent;
|
||||
import org.apache.solr.index.LogDocMergePolicyFactory;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.request.SolrRequestHandler;
|
||||
import org.apache.solr.schema.SchemaField;
|
||||
import org.apache.solr.servlet.DirectSolrConnection;
|
||||
import org.apache.solr.util.plugin.SolrCoreAware;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
public class TestIndexSearcher extends SolrTestCaseJ4 {
|
||||
|
@ -56,11 +58,18 @@ public class TestIndexSearcher extends SolrTestCaseJ4 {
|
|||
|
||||
// we need a consistent segmentation because reopen test validation
|
||||
// dependso n merges not happening when it doesn't expect
|
||||
System.setProperty("solr.tests.mergePolicy", LogDocMergePolicy.class.getName());
|
||||
systemSetPropertySolrTestsMergePolicy(LogDocMergePolicy.class.getName());
|
||||
systemSetPropertySolrTestsMergePolicyFactory(LogDocMergePolicyFactory.class.getName());
|
||||
|
||||
initCore("solrconfig.xml","schema.xml");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() {
|
||||
systemClearPropertySolrTestsMergePolicy();
|
||||
systemClearPropertySolrTestsMergePolicyFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
System.getProperties().remove("tests.solr.useColdSearcher");
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.solr.common.params.MapSolrParams;
|
|||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.core.SolrEventListener;
|
||||
import org.apache.solr.index.TieredMergePolicyFactory;
|
||||
import org.apache.solr.request.LocalSolrQueryRequest;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.search.SolrIndexSearcher;
|
||||
|
@ -56,12 +57,15 @@ public class DirectUpdateHandlerTest extends SolrTestCaseJ4 {
|
|||
savedFactory = System.getProperty("solr.DirectoryFactory");
|
||||
System.setProperty("solr.directoryFactory", "org.apache.solr.core.MockFSDirectoryFactory");
|
||||
System.setProperty("enable.update.log", "false"); // schema12 doesn't support _version_
|
||||
System.setProperty("solr.tests.mergePolicy", TieredMergePolicy.class.getName());
|
||||
systemSetPropertySolrTestsMergePolicy(TieredMergePolicy.class.getName());
|
||||
systemSetPropertySolrTestsMergePolicyFactory(TieredMergePolicyFactory.class.getName());
|
||||
initCore("solrconfig.xml", "schema12.xml");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() {
|
||||
systemClearPropertySolrTestsMergePolicy();
|
||||
systemClearPropertySolrTestsMergePolicyFactory();
|
||||
if (savedFactory == null) {
|
||||
System.clearProperty("solr.directoryFactory");
|
||||
} else {
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.apache.solr.common.util.NamedList;
|
|||
import org.apache.solr.core.CoreContainer;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.core.SolrEventListener;
|
||||
import org.apache.solr.index.LogDocMergePolicyFactory;
|
||||
import org.apache.solr.search.SolrIndexSearcher;
|
||||
import org.apache.solr.update.MockStreamingSolrClients.Exp;
|
||||
import org.apache.solr.update.SolrCmdDistributor.Error;
|
||||
|
@ -51,6 +52,7 @@ import org.apache.solr.update.SolrCmdDistributor.Node;
|
|||
import org.apache.solr.update.SolrCmdDistributor.RetryNode;
|
||||
import org.apache.solr.update.SolrCmdDistributor.StdNode;
|
||||
import org.apache.solr.update.processor.DistributedUpdateProcessor;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.xml.sax.SAXException;
|
||||
|
@ -63,8 +65,16 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
|
|||
public static void beforeClass() throws Exception {
|
||||
// we can't use the Randomized merge policy because the test depends on
|
||||
// being able to call optimize to have all deletes expunged.
|
||||
System.setProperty("solr.tests.mergePolicy", LogDocMergePolicy.class.getName());
|
||||
systemSetPropertySolrTestsMergePolicy(LogDocMergePolicy.class.getName());
|
||||
systemSetPropertySolrTestsMergePolicyFactory(LogDocMergePolicyFactory.class.getName());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() {
|
||||
systemClearPropertySolrTestsMergePolicy();
|
||||
systemClearPropertySolrTestsMergePolicyFactory();
|
||||
}
|
||||
|
||||
private UpdateShardHandler updateShardHandler;
|
||||
|
||||
public SolrCmdDistributorTest() throws ParserConfigurationException, IOException, SAXException {
|
||||
|
|
|
@ -128,6 +128,16 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
public static final String DEFAULT_TEST_CORENAME = DEFAULT_TEST_COLLECTION_NAME;
|
||||
protected static final String CORE_PROPERTIES_FILENAME = "core.properties";
|
||||
|
||||
// keep solr.tests.mergePolicyFactory use i.e. do not remove with SOLR-8668
|
||||
public static final String SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY = "solr.tests.mergePolicyFactory";
|
||||
@Deprecated // remove solr.tests.mergePolicy use with SOLR-8668
|
||||
public static final String SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICY = "solr.tests.mergePolicy";
|
||||
|
||||
@Deprecated // remove solr.tests.useMergePolicyFactory with SOLR-8668
|
||||
public static final String SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICYFACTORY = "solr.tests.useMergePolicyFactory";
|
||||
@Deprecated // remove solr.tests.useMergePolicy use with SOLR-8668
|
||||
public static final String SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICY = "solr.tests.useMergePolicy";
|
||||
|
||||
private static String coreName = DEFAULT_TEST_CORENAME;
|
||||
|
||||
public static int DEFAULT_CONNECTION_TIMEOUT = 60000; // default socket connection timeout in ms
|
||||
|
@ -2077,4 +2087,39 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
registeredSearcher.decref();
|
||||
newestSearcher.decref();
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void chooseMPForMP() throws Exception {
|
||||
if (random().nextBoolean()) {
|
||||
System.setProperty(SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICYFACTORY, "true");
|
||||
System.setProperty(SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICY, "false");
|
||||
} else {
|
||||
System.setProperty(SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICYFACTORY, "false");
|
||||
System.setProperty(SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICY, "true");
|
||||
}
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void unchooseMPForMP() {
|
||||
System.clearProperty(SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICYFACTORY);
|
||||
System.clearProperty(SYSTEM_PROPERTY_SOLR_TESTS_USEMERGEPOLICY);
|
||||
}
|
||||
|
||||
@Deprecated // remove with SOLR-8668
|
||||
protected static void systemSetPropertySolrTestsMergePolicy(String value) {
|
||||
System.setProperty(SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICY, value);
|
||||
}
|
||||
|
||||
@Deprecated // remove with SOLR-8668
|
||||
protected static void systemClearPropertySolrTestsMergePolicy() {
|
||||
System.clearProperty(SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICY);
|
||||
}
|
||||
|
||||
protected static void systemSetPropertySolrTestsMergePolicyFactory(String value) {
|
||||
System.setProperty(SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY, value);
|
||||
}
|
||||
|
||||
protected static void systemClearPropertySolrTestsMergePolicyFactory() {
|
||||
System.clearProperty(SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue