diff --git a/dev-tools/scripts/reproduceJenkinsFailures.py b/dev-tools/scripts/reproduceJenkinsFailures.py index 879e8c01e57..e28ef3aa67c 100644 --- a/dev-tools/scripts/reproduceJenkinsFailures.py +++ b/dev-tools/scripts/reproduceJenkinsFailures.py @@ -38,8 +38,8 @@ reAntInvocation = re.compile(r'\bant(?:\.bat)?\s+.*(?:jenkins-(?:hourly|nightly)|nightly-smoke)') reAntSysprops = re.compile(r'"-D[^"]+"|-D[^=]+="[^"]*"|-D\S+') -# Method example: NOTE: reproduce with: ant test -Dtestcase=ZkSolrClientTest -Dtests.method=testMultipleWatchesAsync -Dtests.seed=6EF5AB70F0032849 -Dtests.slow=true -Dtests.locale=he-IL -Dtests.timezone=NST -Dtests.asserts=true -Dtests.file.encoding=UTF-8 -# Suite example: NOTE: reproduce with: ant test -Dtestcase=CloudSolrClientTest -Dtests.seed=DB2DF2D8228BAF27 -Dtests.multiplier=3 -Dtests.slow=true -Dtests.locale=es-AR -Dtests.timezone=America/Argentina/Cordoba -Dtests.asserts=true -Dtests.file.encoding=US-ASCII +# Method example: NOTE: reproduce with: ant test -Dtestcase=ZkSolrClientTest -Dtests.method=testMultipleWatchesAsync -Dtests.seed=6EF5AB70F0032849 -Dtests.locale=he-IL -Dtests.timezone=NST -Dtests.asserts=true -Dtests.file.encoding=UTF-8 +# Suite example: NOTE: reproduce with: ant test -Dtestcase=CloudSolrClientTest -Dtests.seed=DB2DF2D8228BAF27 -Dtests.multiplier=3 -Dtests.locale=es-AR -Dtests.timezone=America/Argentina/Cordoba -Dtests.asserts=true -Dtests.file.encoding=US-ASCII reReproLine = re.compile(r'NOTE:\s+reproduce\s+with:(\s+ant\s+test\s+-Dtestcase=(\S+)\s+(?:-Dtests.method=\S+\s+)?(.*))') reTestsSeed = re.compile(r'-Dtests.seed=\S+\s*') diff --git a/gradle/testing/randomization.gradle b/gradle/testing/randomization.gradle index 8d61a35e8e4..044ece428bc 100644 --- a/gradle/testing/randomization.gradle +++ b/gradle/testing/randomization.gradle @@ -85,7 +85,6 @@ allprojects { [propName: 'tests.timezone', value: "random", description: "Sets the default time zone tests should run with."], // filtering [propName: 'tests.filter', value: null, description: "Applies a test filter (see :helpTests)."], - [propName: 'tests.slow', value: true, description: "Enables or disables @Slow tests."], [propName: 'tests.nightly', value: false, description: "Enables or disables @Nightly tests."], [propName: 'tests.weekly', value: false, description: "Enables or disables @Weekly tests."], [propName: 'tests.monster', value: false, description: "Enables or disables @Monster tests."], diff --git a/help/tests.txt b/help/tests.txt index 7022688da08..c1f79cfebc9 100644 --- a/help/tests.txt +++ b/help/tests.txt @@ -68,17 +68,17 @@ Test groups ----------- Tests can be filtered by an annotation they're marked with. -Some test group annotations include: @AwaitsFix, @Nightly, @Slow +Some test group annotations include: @AwaitsFix, @Nightly, @Monster This uses filtering infrastructure on the *runner* (randomizedtesting), not gradle's built-in mechanisms (but it can be combined with "--tests"). -For example, run all solr-core tests annotated as @Slow: +For example, run all solr-core tests annotated as @Nightly: -gradlew -p solr/core test -Ptests.filter=@Slow +gradlew -p solr/core test -Ptests.filter=@Nightly Test group filters can be combined into Boolean expressions: -gradlew -p solr/core test "default and not(@awaitsfix or @slow)" +gradlew -p solr/core test -Ptests.filter="default and not(@awaitsfix)" Reiteration ("beasting") diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 3e96a905694..1b506740eca 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -141,6 +141,8 @@ Other Changes * SOLR-16231: Fix ref-guide links across the codebase (Houston Putman) +* SOLR-16304: No more @Slow annotation for tests! (Mike Drob) + Build --------------------- * SOLR-16204: Change Lucene dependency to Lucene 9.1.0 (Elia Porciani via Alessandro Benedetti) diff --git a/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java b/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java index c943e1b3ee2..712bc9b4367 100644 --- a/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java +++ b/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java @@ -238,7 +238,7 @@ private void _write(OutputStream os) throws IOException { // obscure a condition to handle as part of this patch, if someone wants to pursue it can be // reproduced with: // ant test -Dtestcase=StreamingTest -Dtests.method=testAllValidExportTypes - // -Dtests.seed=10F13879D0D1D6AD -Dtests.slow=true -Dtests.locale=es-PA + // -Dtests.seed=10F13879D0D1D6AD -Dtests.locale=es-PA // -Dtests.timezone=America/Bahia_Banderas -Dtests.asserts=true -Dtests.file.encoding=ISO-8859-1 // You'll have to uncomment the if below to hit the null pointer exception. // This is such an unusual case (i.e. an empty index) that catching this concdition here is diff --git a/solr/core/src/test/org/apache/solr/DistributedIntervalFacetingTest.java b/solr/core/src/test/org/apache/solr/DistributedIntervalFacetingTest.java index 4e1053c917a..380f5d9fb28 100644 --- a/solr/core/src/test/org/apache/solr/DistributedIntervalFacetingTest.java +++ b/solr/core/src/test/org/apache/solr/DistributedIntervalFacetingTest.java @@ -18,7 +18,6 @@ import java.util.Arrays; import java.util.List; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.response.IntervalFacet.Count; @@ -27,7 +26,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-9182 - causes OOM") // See: https://issues.apache.org/jira/browse/SOLR-12028 Tests cannot remove files on Windows // machines occasionally diff --git a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java index e91c01124dc..ae55c613c26 100644 --- a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java +++ b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java @@ -20,7 +20,6 @@ import java.io.IOException; import java.util.List; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4.SuppressPointFields; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrServerException; @@ -39,7 +38,6 @@ * * @since solr 4.0 */ -@Slow @SuppressPointFields(bugUrl = "https://issues.apache.org/jira/browse/SOLR-10844") public class TestDistributedGrouping extends BaseDistributedSearchTestCase { diff --git a/solr/core/src/test/org/apache/solr/TestDistributedMissingSort.java b/solr/core/src/test/org/apache/solr/TestDistributedMissingSort.java index 6165c4737e8..05f62673e40 100644 --- a/solr/core/src/test/org/apache/solr/TestDistributedMissingSort.java +++ b/solr/core/src/test/org/apache/solr/TestDistributedMissingSort.java @@ -16,12 +16,10 @@ */ package org.apache.solr; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.response.QueryResponse; import org.junit.Test; /** Tests sortMissingFirst and sortMissingLast in distributed sort */ -@Slow public class TestDistributedMissingSort extends BaseDistributedSearchTestCase { public TestDistributedMissingSort() { diff --git a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java index e77714f7abb..2d33dced1a2 100644 --- a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java +++ b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java @@ -32,7 +32,6 @@ import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.Future; import org.apache.commons.lang3.StringUtils; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; @@ -71,7 +70,6 @@ * * @since solr 1.3 */ -@Slow @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-9061") public class TestDistributedSearch extends BaseDistributedSearchTestCase { diff --git a/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java b/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java index 6f6eb41b91c..05479263a3f 100644 --- a/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java +++ b/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java @@ -22,7 +22,6 @@ import java.util.List; import java.util.Map; import java.util.Random; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.request.SolrQueryRequest; @@ -39,7 +38,6 @@ * and compares the docvalues facet results to the indexed facet results as if it were just another * faceting method. */ -@Slow @SolrTestCaseJ4.SuppressPointFields( bugUrl = "Test explicitly compares Trie to Points, randomization defeats the point") @SolrTestCaseJ4.SuppressSSL diff --git a/solr/core/src/test/org/apache/solr/TestRandomFaceting.java b/solr/core/src/test/org/apache/solr/TestRandomFaceting.java index 3a1fbe70279..806dd4f896c 100644 --- a/solr/core/src/test/org/apache/solr/TestRandomFaceting.java +++ b/solr/core/src/test/org/apache/solr/TestRandomFaceting.java @@ -29,7 +29,6 @@ import java.util.Set; import java.util.function.Consumer; import java.util.regex.Pattern; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.common.SolrException.ErrorCode; import org.apache.solr.common.params.ModifiableSolrParams; @@ -41,7 +40,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow public class TestRandomFaceting extends SolrTestCaseJ4 { private static final Pattern trieFields = Pattern.compile(".*_t."); diff --git a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java index aaca894c3cf..7975cfb68d3 100644 --- a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java @@ -16,7 +16,6 @@ */ package org.apache.solr.cloud; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.junit.Test; @@ -25,7 +24,6 @@ * expected. Implementation moved to AbstractBasicDistributedZkTestBase as it is used by many HDFS * contrib tests. */ -@Slow @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") public class BasicDistributedZkTest extends AbstractBasicDistributedZkTestBase { diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java index 537a717c249..3fb1bbabc6e 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java @@ -16,13 +16,11 @@ */ package org.apache.solr.cloud; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; /* * Implementation moved to AbstractChaosMonkeyNothingIsSafeTestBase.java as it is also * used by the HDFS contrib tests. */ -@Slow @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") public class ChaosMonkeyNothingIsSafeTest extends AbstractChaosMonkeyNothingIsSafeTestBase {} diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeWithPullReplicasTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeWithPullReplicasTest.java index fcf450605d3..d27fbe00c1f 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeWithPullReplicasTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeWithPullReplicasTest.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.impl.CloudLegacySolrClient; @@ -42,7 +42,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow +@LuceneTestCase.Nightly @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") public class ChaosMonkeyNothingIsSafeWithPullReplicasTest extends AbstractFullDistribZkTestBase { private static final int FAIL_TOLERANCE = 100; diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java index 3d1ff3e0eee..a4c1ab267d1 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java @@ -16,18 +16,12 @@ */ package org.apache.solr.cloud; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; - /* * Implementation moved to AbstractChaosMonkeySafeLeaderTestBase as is used by HDFS contrib module test */ -@Slow public class ChaosMonkeySafeLeaderTest extends AbstractChaosMonkeySafeLeaderTestBase { - - private static final String DIRECTORY_FACTORY = "solr.StandardDirectoryFactory"; - @Override protected String getDirectoryFactory() { - return DIRECTORY_FACTORY; + return "solr.StandardDirectoryFactory"; } } diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderWithPullReplicasTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderWithPullReplicasTest.java index e5b2b90ffef..d98f200ac5f 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderWithPullReplicasTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderWithPullReplicasTest.java @@ -21,7 +21,7 @@ import java.util.EnumSet; import java.util.List; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.CloudSolrClient; @@ -40,7 +40,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow +@LuceneTestCase.Nightly public class ChaosMonkeySafeLeaderWithPullReplicasTest extends AbstractFullDistribZkTestBase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java index 063ff77f335..6a0b2a5a9a9 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyShardSplitTest.java @@ -23,12 +23,10 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.cloud.api.collections.ShardSplitTest; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.cloud.ClusterState; -import org.apache.solr.common.cloud.DocCollection; import org.apache.solr.common.cloud.DocRouter; import org.apache.solr.common.cloud.Replica; import org.apache.solr.common.cloud.Slice; @@ -47,7 +45,6 @@ import org.slf4j.LoggerFactory; /** Test split phase that occurs when a Collection API split call is made. */ -@Slow @Ignore("SOLR-4944") public class ChaosMonkeyShardSplitTest extends ShardSplitTest { @@ -216,28 +213,21 @@ public void run() { } private void waitTillRecovered() throws Exception { - for (int i = 0; i < 30; i++) { - Thread.sleep(3000); - ZkStateReader zkStateReader = ZkStateReader.from(cloudClient); - zkStateReader.forceUpdateCollection("collection1"); - ClusterState clusterState = zkStateReader.getClusterState(); - DocCollection collection1 = clusterState.getCollection("collection1"); - Slice slice = collection1.getSlice("shard1"); - Collection replicas = slice.getReplicas(); - boolean allActive = true; - for (Replica replica : replicas) { - if (!clusterState.liveNodesContain(replica.getNodeName()) - || replica.getState() != Replica.State.ACTIVE) { - allActive = false; - break; - } - } - if (allActive) { - return; - } - } - printLayout(); - fail("timeout waiting to see recovered node"); + ZkStateReader zkStateReader = ZkStateReader.from(cloudClient); + zkStateReader.waitForState( + "collection1", + 90, + TimeUnit.SECONDS, + (n, c) -> { + Collection replicas = c.getSlice("shard1").getReplicas(); + for (Replica replica : replicas) { + if (n.contains(replica.getNodeName()) == false + || replica.getState() != Replica.State.ACTIVE) { + return false; + } + } + return true; + }); } // skip the randoms - they can deadlock... diff --git a/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java b/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java index 6ff081ae7ab..69c7c0f4eea 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java @@ -22,7 +22,6 @@ import java.util.Locale; import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.client.solrj.embedded.JettySolrRunner; import org.apache.solr.client.solrj.request.CollectionAdminRequest; import org.apache.solr.common.cloud.DocCollection; @@ -33,7 +32,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@LuceneTestCase.Slow public class CleanupOldIndexTest extends SolrCloudTestCase { @BeforeClass @@ -64,8 +62,7 @@ public void test() throws Exception { // TODO make this configurable on StoppableIndexingThread cluster.getSolrClient().setDefaultCollection(COLLECTION); - int[] maxDocList = new int[] {300, 500, 700}; - int maxDoc = maxDocList[random().nextInt(maxDocList.length - 1)]; + int maxDoc = atLeast(300); StoppableIndexingThread indexThread = new StoppableIndexingThread(null, cluster.getSolrClient(), "1", true, maxDoc, 1, true); @@ -123,7 +120,7 @@ public void test() throws Exception { TimeUnit.SECONDS, (n, c) -> DocCollection.isFullyActive(n, c, 1, 2)); - assertTrue(!oldIndexDir1.isDirectory()); - assertTrue(!oldIndexDir2.isDirectory()); + assertFalse(oldIndexDir1.isDirectory()); + assertFalse(oldIndexDir2.isDirectory()); } } diff --git a/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java b/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java index 5dc7bc234a7..a238413039d 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java @@ -18,7 +18,6 @@ import java.util.Map; import java.util.Set; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.embedded.JettySolrRunner; import org.apache.solr.client.solrj.request.CollectionAdminRequest; import org.apache.solr.common.cloud.ClusterState; @@ -30,22 +29,17 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow public class ClusterStateUpdateTest extends SolrCloudTestCase { - @Override - public void setUp() throws Exception { - super.setUp(); - configureCluster(3).addConfig("conf", configset("cloud-minimal")).configure(); - } - @BeforeClass - public static void beforeClass() { + public static void beforeClass() throws Exception { System.setProperty("solrcloud.skip.autorecovery", "true"); + configureCluster(3).addConfig("conf", configset("cloud-minimal")).configure(); } @AfterClass - public static void afterClass() { + public static void afterClass() throws Exception { + shutdownCluster(); System.clearProperty("solrcloud.skip.autorecovery"); System.clearProperty("genericCoreNodeNames"); } diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java index 2a5f232618a..7d963ee6b9a 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java @@ -28,7 +28,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.request.CollectionAdminRequest; import org.apache.solr.client.solrj.response.CollectionAdminResponse; @@ -42,7 +41,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@LuceneTestCase.Slow @SolrTestCaseJ4.SuppressSSL public class CollectionPropsTest extends SolrCloudTestCase { private static final int TIMEOUT = 5000; diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java index babe4e6046e..ecb48c6fae3 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java @@ -37,7 +37,6 @@ import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrRequest; @@ -69,19 +68,17 @@ import org.apache.solr.common.util.TimeSource; import org.apache.solr.common.util.Utils; import org.apache.solr.util.TimeOut; -import org.junit.After; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@LuceneTestCase.Slow public class CollectionsAPISolrJTest extends SolrCloudTestCase { private static final int TIMEOUT = 3000; private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - @Before - public void beforeTest() throws Exception { + @BeforeClass + public static void beforeTest() throws Exception { // System.setProperty("metricsEnabled", "true"); configureCluster(4) .addConfig("conf", configset("cloud-minimal")) @@ -89,17 +86,12 @@ public void beforeTest() throws Exception { .configure(); } - @After - public void afterTest() throws Exception { - shutdownCluster(); - } - /** * When a config name is not specified during collection creation, the _default should be used. */ @Test public void testCreateWithDefaultConfigSet() throws Exception { - String collectionName = "solrj_default_configset"; + String collectionName = getSaferTestName(); CollectionAdminResponse response = CollectionAdminRequest.createCollection(collectionName, 2, 2) .setPerReplicaState(SolrCloudTestCase.USE_PER_REPLICA_STATE) @@ -116,6 +108,8 @@ public void testCreateWithDefaultConfigSet() throws Exception { assertEquals(0, (int) status.get("status")); assertTrue(status.get("QTime") > 0); } + // Sometimes multiple cores land on the same node so it's less than 4 + int nodesCreated = response.getCollectionNodesStatus().size(); // Use of _default configset should generate a warning for data-driven functionality in // production use assertTrue( @@ -127,7 +121,7 @@ public void testCreateWithDefaultConfigSet() throws Exception { assertEquals(0, response.getStatus()); assertTrue(response.isSuccess()); Map> nodesStatus = response.getCollectionNodesStatus(); - assertEquals(4, nodesStatus.size()); + assertEquals(nodesStatus.toString(), nodesCreated, nodesStatus.size()); waitForState( "Expected " + collectionName + " to disappear from cluster state", @@ -347,7 +341,7 @@ public void testCreateCollWithDefaultClusterPropertiesNewFormat() throws Excepti @Test public void testCreateAndDeleteCollection() throws Exception { - String collectionName = "solrj_test"; + String collectionName = getSaferTestName(); CollectionAdminResponse response = CollectionAdminRequest.createCollection(collectionName, "conf", 2, 2) .process(cluster.getSolrClient()); @@ -362,13 +356,16 @@ public void testCreateAndDeleteCollection() throws Exception { assertTrue(status.get("QTime") > 0); } + // Sometimes multiple cores land on the same node so it's less than 4 + int nodesCreated = response.getCollectionNodesStatus().size(); response = CollectionAdminRequest.deleteCollection(collectionName).process(cluster.getSolrClient()); assertEquals(0, response.getStatus()); assertTrue(response.isSuccess()); Map> nodesStatus = response.getCollectionNodesStatus(); - assertEquals(4, nodesStatus.size()); + // Delete could have been sent before the collection was finished coming online + assertEquals(nodesStatus.toString(), nodesCreated, nodesStatus.size()); waitForState( "Expected " + collectionName + " to disappear from cluster state", @@ -392,7 +389,7 @@ public void testCreateAndDeleteCollection() throws Exception { @Test public void testCloudInfoInCoreStatus() throws IOException, SolrServerException { - String collectionName = "corestatus_test"; + String collectionName = getSaferTestName(); CollectionAdminResponse response = CollectionAdminRequest.createCollection(collectionName, "conf", 2, 2) .process(cluster.getSolrClient()); @@ -492,8 +489,7 @@ public void testCreateAndDeleteAlias() throws IOException, SolrServerException { @Test public void testSplitShard() throws Exception { - - final String collectionName = "solrj_test_splitshard"; + String collectionName = getSaferTestName(); CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1) .setPerReplicaState(SolrCloudTestCase.USE_PER_REPLICA_STATE) .process(cluster.getSolrClient()); @@ -546,8 +542,7 @@ public void testSplitShard() throws Exception { @Test public void testCreateCollectionWithPropertyParam() throws Exception { - - String collectionName = "solrj_test_core_props"; + String collectionName = getSaferTestName(); Path tmpDir = createTempDir("testPropertyParamsForCreate"); Path dataDir = tmpDir.resolve("dataDir-" + TestUtil.randomSimpleString(random(), 1, 5)); @@ -579,8 +574,7 @@ public void testCreateCollectionWithPropertyParam() throws Exception { @Test public void testAddAndDeleteReplica() throws Exception { - - final String collectionName = "solrj_replicatests"; + String collectionName = getSaferTestName(); CollectionAdminRequest.createCollection(collectionName, "conf", 1, 2) .setPerReplicaState(SolrCloudTestCase.USE_PER_REPLICA_STATE) .process(cluster.getSolrClient()); @@ -640,16 +634,15 @@ public void testClusterProp() throws IOException, SolrServerException { assertEquals(0, response.getStatus()); assertEquals( "Cluster property was not set", - props.getClusterProperty(ZkStateReader.MAX_CORES_PER_NODE, null), - "42"); + "42", + props.getClusterProperty(ZkStateReader.MAX_CORES_PER_NODE, null)); // Unset ClusterProp that we set. CollectionAdminRequest.setClusterProperty(ZkStateReader.MAX_CORES_PER_NODE, null) .process(cluster.getSolrClient()); - assertEquals( + assertNull( "Cluster property was not unset", - props.getClusterProperty(ZkStateReader.MAX_CORES_PER_NODE, null), - null); + props.getClusterProperty(ZkStateReader.MAX_CORES_PER_NODE, null)); response = CollectionAdminRequest.setClusterProperty(ZkStateReader.MAX_CORES_PER_NODE, "1") @@ -657,13 +650,13 @@ public void testClusterProp() throws IOException, SolrServerException { assertEquals(0, response.getStatus()); assertEquals( "Cluster property was not set", - props.getClusterProperty(ZkStateReader.MAX_CORES_PER_NODE, null), - "1"); + "1", + props.getClusterProperty(ZkStateReader.MAX_CORES_PER_NODE, null)); } @Test public void testCollectionProp() throws InterruptedException, IOException, SolrServerException { - final String collectionName = "collectionPropTest"; + String collectionName = getSaferTestName(); final String propName = "testProperty"; CollectionAdminRequest.createCollection(collectionName, "conf", 2, 2) @@ -700,7 +693,7 @@ private void checkCollectionProperty(String collection, String propertyName, Str @Test public void testColStatus() throws Exception { - final String collectionName = "collectionStatusTest"; + String collectionName = getSaferTestName(); CollectionAdminRequest.createCollection(collectionName, "conf2", 2, 2) .setPerReplicaState(SolrCloudTestCase.USE_PER_REPLICA_STATE) .process(cluster.getSolrClient()); @@ -831,7 +824,7 @@ public void testColStatusCollectionName() throws Exception { @Test public void testReadOnlyCollection() throws Exception { - final String collectionName = "readOnlyTest"; + String collectionName = getSaferTestName(); CloudSolrClient solrClient = cluster.getSolrClient(); CollectionAdminRequest.createCollection(collectionName, "conf", 2, 2).process(solrClient); diff --git a/solr/core/src/test/org/apache/solr/cloud/ConcurrentCreateRoutedAliasTest.java b/solr/core/src/test/org/apache/solr/cloud/ConcurrentCreateRoutedAliasTest.java index d7a452f7225..3046181c193 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ConcurrentCreateRoutedAliasTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ConcurrentCreateRoutedAliasTest.java @@ -30,7 +30,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@LuceneTestCase.Slow @LuceneTestCase.AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-12386") public class ConcurrentCreateRoutedAliasTest extends SolrTestCaseJ4 { diff --git a/solr/core/src/test/org/apache/solr/cloud/ConnectionManagerTest.java b/solr/core/src/test/org/apache/solr/cloud/ConnectionManagerTest.java index 6ca979d3c2e..14dec585f45 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ConnectionManagerTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ConnectionManagerTest.java @@ -21,7 +21,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeoutException; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.cloud.ConnectionManager; import org.apache.solr.common.cloud.SolrZkClient; @@ -35,7 +34,6 @@ import org.junit.Ignore; import org.junit.Test; -@Slow public class ConnectionManagerTest extends SolrTestCaseJ4 { static final int TIMEOUT = 3000; diff --git a/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java b/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java index 37da5c0d651..f5fb02391c7 100644 --- a/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java @@ -49,7 +49,6 @@ import org.apache.solr.util.TimeOut; import org.junit.After; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,12 +57,6 @@ public class DeleteReplicaTest extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - @BeforeClass - public static void setupCluster() { - System.setProperty("solr.zkclienttimeout", "45000"); - System.setProperty("distribUpdateSoTimeout", "15000"); - } - @Before @Override public void setUp() throws Exception { @@ -320,7 +313,6 @@ public void deleteReplicaFromClusterState() throws Exception { } @Test - @Slow public void raceConditionOnDeleteAndRegisterReplica() throws Exception { final String collectionName = "raceDeleteReplicaCollection"; CollectionAdminRequest.createCollection(collectionName, "conf", 1, 2) diff --git a/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java b/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java index 593bce0271a..f8de32bba34 100644 --- a/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java @@ -29,7 +29,6 @@ import java.util.function.Consumer; import java.util.stream.IntStream; import org.apache.commons.lang3.StringUtils; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.lucene.util.SentinelIntSet; import org.apache.solr.CursorPagingTest; @@ -58,7 +57,6 @@ * * @see CursorPagingTest */ -@Slow @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-9182 - causes OOM") public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase { diff --git a/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java index 1b858be2638..0aa13d8fd5b 100644 --- a/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java @@ -27,7 +27,7 @@ import java.util.Objects; import java.util.Set; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.client.solrj.SolrRequest; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.HttpSolrClient; @@ -50,11 +50,12 @@ import org.apache.solr.update.processor.DocExpirationUpdateProcessorFactory; import org.apache.solr.util.TimeOut; import org.junit.After; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** Test of {@link DocExpirationUpdateProcessorFactory} in a cloud setup */ -@Slow // Has to do some sleeping to wait for a future expiration +@LuceneTestCase.Nightly // Has to do some sleeping to wait for a future expiration public class DistribDocExpirationUpdateProcessorTest extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -129,17 +130,19 @@ public void setupCluster(boolean security) throws Exception { (n, c) -> DocCollection.isFullyActive(n, c, 2, 2)); } + @Test public void testNoAuth() throws Exception { setupCluster(false); runTest(); } + @Test public void testBasicAuth() throws Exception { setupCluster(true); - // sanity check that our cluster really does require authentication + // check that our cluster really does require authentication assertEquals( - "sanity check of non authenticated request", + "check of unauthenticated request", 401, expectThrows( SolrException.class, @@ -152,7 +155,7 @@ public void testBasicAuth() throws Exception { params( "q", "*:*", "rows", "0", - "_trace", "no_auth_sanity_check")) + "_trace", "no_auth_check")) .getResults() .getNumFound(); }) diff --git a/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java b/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java index 37fb9b31d5d..ba4379727bc 100644 --- a/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java @@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.JSONTestUtil; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.SolrClient; @@ -58,7 +58,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow +@LuceneTestCase.Nightly // Lots of sleeps to introduce timing delays? @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") public class DistributedVersionInfoTest extends SolrCloudTestCase { diff --git a/solr/core/src/test/org/apache/solr/cloud/ForceLeaderTest.java b/solr/core/src/test/org/apache/solr/cloud/ForceLeaderTest.java index e4f9ddbacd2..ea4319a67a9 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ForceLeaderTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ForceLeaderTest.java @@ -65,7 +65,6 @@ public void test() {} * leader's term are live */ @Test - @Slow public void testReplicasInLowerTerms() throws Exception { handle.put("maxScore", SKIPVAL); handle.put("timestamp", SKIPVAL); diff --git a/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java b/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java index 20fc04b8442..546ea4fbbcd 100644 --- a/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudDistribCmdsTest.java @@ -27,7 +27,6 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; @@ -57,7 +56,6 @@ import org.slf4j.LoggerFactory; /** Super basic testing, no shard restarting or anything. */ -@Slow public class FullSolrCloudDistribCmdsTest extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final AtomicInteger NAME_COUNTER = new AtomicInteger(1); @@ -84,10 +82,10 @@ public void purgeAllCollections() throws Exception { public static String createAndSetNewDefaultCollection() throws Exception { final CloudSolrClient cloudClient = cluster.getSolrClient(); final String name = "test_collection_" + NAME_COUNTER.getAndIncrement(); - assertEquals( - RequestStatusState.COMPLETED, + assertTrue( CollectionAdminRequest.createCollection(name, "_default", 2, 2) - .processAndWait(cloudClient, DEFAULT_TIMEOUT)); + .process(cloudClient) + .isSuccess()); ZkStateReader.from(cloudClient) .waitForState( name, diff --git a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java index 9cd5192259a..c7dcbc40e71 100644 --- a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java @@ -32,7 +32,7 @@ import java.util.Optional; import java.util.Set; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.JSONTestUtil; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.SolrClient; @@ -70,7 +70,7 @@ * Simulates HTTP partitions between a leader and replica but the replica does not lose its * ZooKeeper connection. */ -@Slow +@LuceneTestCase.Nightly // there are recovery commands that take a while to time out @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") public class HttpPartitionTest extends AbstractFullDistribZkTestBase { diff --git a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionWithTlogReplicasTest.java b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionWithTlogReplicasTest.java index b5100e895e6..fb1db0fd770 100644 --- a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionWithTlogReplicasTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionWithTlogReplicasTest.java @@ -18,10 +18,8 @@ package org.apache.solr.cloud; import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.SolrTestCaseJ4; -@LuceneTestCase.Slow @SolrTestCaseJ4.SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") @ThreadLeakLingering(linger = 10) public class HttpPartitionWithTlogReplicasTest extends HttpPartitionTest { diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java index bc5fcd2e44a..67868bd4b1b 100644 --- a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java @@ -20,7 +20,6 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.JettySolrRunner; import org.apache.solr.client.solrj.request.CollectionAdminRequest; @@ -30,7 +29,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow public class LeaderElectionIntegrationTest extends SolrCloudTestCase { private static final int NUM_REPLICAS_OF_SHARD1 = 5; diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java index 76c721ff427..70519f1066e 100644 --- a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java @@ -28,7 +28,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.cloud.OnReconnect; import org.apache.solr.common.cloud.SolrZkClient; @@ -42,13 +41,10 @@ import org.apache.zookeeper.KeeperException.SessionExpiredException; import org.apache.zookeeper.TestableZooKeeper; import org.apache.zookeeper.ZooKeeper; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow public class LeaderElectionTest extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -61,12 +57,6 @@ public class LeaderElectionTest extends SolrTestCaseJ4 { private volatile boolean stopStress = false; - @BeforeClass - public static void beforeClass() {} - - @AfterClass - public static void afterClass() {} - @Override public void setUp() throws Exception { super.setUp(); diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderFailoverAfterPartitionTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderFailoverAfterPartitionTest.java index 8ae28882c9f..ba317ba03de 100644 --- a/solr/core/src/test/org/apache/solr/cloud/LeaderFailoverAfterPartitionTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/LeaderFailoverAfterPartitionTest.java @@ -22,7 +22,6 @@ import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.cloud.SocketProxy; import org.apache.solr.client.solrj.embedded.JettySolrRunner; @@ -38,7 +37,6 @@ * Tests leader-initiated recovery scenarios after a leader node fails and one of the replicas is * out-of-sync. */ -@Slow @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") public class LeaderFailoverAfterPartitionTest extends HttpPartitionTest { diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderFailureAfterFreshStartTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderFailureAfterFreshStartTest.java index 92c49e684c7..289950cf850 100644 --- a/solr/core/src/test/org/apache/solr/cloud/LeaderFailureAfterFreshStartTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/LeaderFailureAfterFreshStartTest.java @@ -32,15 +32,11 @@ import java.util.stream.Collectors; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.RandomStringUtils; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.cloud.ZkTestServer.LimitViolationAction; import org.apache.solr.common.SolrInputDocument; -import org.apache.solr.common.cloud.ClusterState; -import org.apache.solr.common.cloud.DocCollection; import org.apache.solr.common.cloud.Replica; -import org.apache.solr.common.cloud.Slice; import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.util.TimeSource; @@ -54,7 +50,6 @@ * *

This test is modeled after SyncSliceTest */ -@Slow public class LeaderFailureAfterFreshStartTest extends AbstractFullDistribZkTestBase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -210,37 +205,21 @@ private void forceNodeFailures(List replicasToShutDown) throws } private void waitTillNodesActive() throws Exception { - for (int i = 0; i < 60; i++) { - Thread.sleep(3000); - ZkStateReader zkStateReader = ZkStateReader.from(cloudClient); - ClusterState clusterState = zkStateReader.getClusterState(); - DocCollection collection1 = clusterState.getCollection("collection1"); - Slice slice = collection1.getSlice("shard1"); - Collection replicas = slice.getReplicas(); - boolean allActive = true; - - Collection nodesDownNames = - nodesDown.stream().map(n -> n.coreNodeName).collect(Collectors.toList()); - - Collection replicasToCheck = null; - replicasToCheck = - replicas.stream() + ZkStateReader zkStateReader = ZkStateReader.from(cloudClient); + + zkStateReader.waitForState( + "collection1", + 3, + TimeUnit.MINUTES, + (n, c) -> { + Collection nodesDownNames = + nodesDown.stream().map(runner -> runner.coreNodeName).collect(Collectors.toList()); + + Collection replicas = c.getSlice("shard1").getReplicas(); + return replicas.stream() .filter(r -> !nodesDownNames.contains(r.getName())) - .collect(Collectors.toList()); - - for (Replica replica : replicasToCheck) { - if (!clusterState.liveNodesContain(replica.getNodeName()) - || replica.getState() != Replica.State.ACTIVE) { - allActive = false; - break; - } - } - if (allActive) { - return; - } - } - printLayout(); - fail("timeout waiting to see all nodes active"); + .allMatch(r -> r.getState() == Replica.State.ACTIVE && n.contains(r.getNodeName())); + }); } private List getOtherAvailableJetties(CloudJettyRunner leader) { diff --git a/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java b/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java index db41e736f9e..eaa64252676 100644 --- a/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java @@ -20,7 +20,6 @@ import java.lang.invoke.MethodHandles; import java.util.Map; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.BaseHttpSolrClient; @@ -41,7 +40,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@LuceneTestCase.Slow public class MigrateRouteKeyTest extends SolrCloudTestCase { @BeforeClass @@ -111,7 +109,7 @@ public void multipleShardMigrateTest() throws Exception { final String splitKey = "a"; final int BIT_SEP = 1; - final int[] splitKeyCount = new int[1]; + int splitKeyCount = 0; for (int id = 0; id < 26 * 3; id++) { String shardKey = "" + (char) ('a' + (id % 26)); // See comment in ShardRoutingTest for hash distribution @@ -123,9 +121,9 @@ public void multipleShardMigrateTest() throws Exception { doc.addField("id", key + "!" + id); doc.addField("n_ti", id); cluster.getSolrClient().add("sourceCollection", doc); - if (splitKey.equals(shardKey)) splitKeyCount[0]++; + if (splitKey.equals(shardKey)) splitKeyCount++; } - assertTrue(splitKeyCount[0] > 0); + assertTrue(splitKeyCount > 0); String targetCollection = "migrate_multipleshardtest_targetCollection"; CollectionAdminRequest.createCollection(targetCollection, "conf", 1, 1) @@ -152,11 +150,11 @@ public void multipleShardMigrateTest() throws Exception { long finishTime = System.nanoTime(); indexer.join(); - splitKeyCount[0] += indexer.getSplitKeyCount(); + splitKeyCount += indexer.getSplitKeyCount(); try { cluster.getSolrClient().deleteById("a/" + BIT_SEP + "!104"); - splitKeyCount[0]--; + splitKeyCount--; } catch (Exception e) { log.warn("Error deleting document a/{}!104", BIT_SEP, e); } @@ -168,7 +166,7 @@ public void multipleShardMigrateTest() throws Exception { log.info("Response from target collection: {}", response); assertEquals( "DocCount on target collection does not match", - splitKeyCount[0], + splitKeyCount, response.getResults().getNumFound()); waitForState( diff --git a/solr/core/src/test/org/apache/solr/cloud/MissingSegmentRecoveryTest.java b/solr/core/src/test/org/apache/solr/cloud/MissingSegmentRecoveryTest.java index 8fade264add..4e071f7974f 100644 --- a/solr/core/src/test/org/apache/solr/cloud/MissingSegmentRecoveryTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/MissingSegmentRecoveryTest.java @@ -22,7 +22,6 @@ import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.JettySolrRunner; @@ -38,7 +37,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow public class MissingSegmentRecoveryTest extends SolrCloudTestCase { final String collection = getClass().getSimpleName(); diff --git a/solr/core/src/test/org/apache/solr/cloud/NodeRolesTest.java b/solr/core/src/test/org/apache/solr/cloud/NodeRolesTest.java index 56556d6a517..2cc9456c6fa 100644 --- a/solr/core/src/test/org/apache/solr/cloud/NodeRolesTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/NodeRolesTest.java @@ -25,21 +25,17 @@ import org.apache.solr.client.solrj.request.V2Request; import org.apache.solr.client.solrj.response.V2Response; import org.apache.solr.core.NodeRoles; -import org.junit.After; -import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; public class NodeRolesTest extends SolrCloudTestCase { - @Before - public void setupCluster() throws Exception { + @BeforeClass + public static void setupCluster() throws Exception { configureCluster(1).addConfig("conf", configset("cloud-minimal")).configure(); } - @After - public void tearDownCluster() throws Exception { - shutdownCluster(); - } - + @Test public void testRoleIntegration() throws Exception { JettySolrRunner j0 = cluster.getJettySolrRunner(0); testSupportedRolesAPI(); diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java index 4fc3c5fb986..0ba30acfff3 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java @@ -31,8 +31,7 @@ import org.apache.solr.common.util.TimeSource; import org.apache.solr.util.TimeOut; import org.apache.zookeeper.KeeperException; -import org.junit.After; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,16 +40,11 @@ public class OverseerRolesTest extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - @Before - public void setupCluster() throws Exception { + @BeforeClass + public static void setupCluster() throws Exception { configureCluster(4).addConfig("conf", configset("cloud-minimal")).configure(); } - @After - public void tearDownCluster() throws Exception { - shutdownCluster(); - } - public static void waitForNewOverseer( int seconds, Predicate state, boolean failOnIntermediateTransition) throws Exception { TimeOut timeout = new TimeOut(seconds, TimeUnit.SECONDS, TimeSource.NANO_TIME); diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java index 947dd8e6310..2332060736d 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java @@ -29,7 +29,6 @@ public class OverseerStatusTest extends SolrCloudTestCase { @BeforeClass public static void setupCluster() throws Exception { configureCluster(2).addConfig("conf", configset("cloud-minimal")).configure(); - ; } @Test diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java index 616ee01c8d4..980e29eaf22 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java @@ -47,7 +47,6 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.cloud.DistributedQueue; @@ -107,7 +106,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow @SolrTestCaseJ4.SuppressSSL public class OverseerTest extends SolrTestCaseJ4 { @@ -1185,7 +1183,7 @@ public void testShardLeaderChange() throws Exception { ZkController.createClusterZkNodes(zkClient); killer = new OverseerRestarter(server.getZkAddress()); - killerThread = new Thread(killer); + killerThread = new Thread(killer, "OverseerRestarter"); killerThread.start(); reader = new ZkStateReader(zkClient); diff --git a/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java b/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java index 227b0ebf9f6..f9ee3b97f0e 100644 --- a/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java @@ -36,16 +36,12 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import org.apache.commons.lang3.RandomStringUtils; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.cloud.ZkTestServer.LimitViolationAction; import org.apache.solr.common.SolrInputDocument; -import org.apache.solr.common.cloud.ClusterState; -import org.apache.solr.common.cloud.DocCollection; import org.apache.solr.common.cloud.Replica; -import org.apache.solr.common.cloud.Slice; import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.util.TimeSource; @@ -61,7 +57,6 @@ * *

This test is modeled after SyncSliceTest */ -@Slow public class PeerSyncReplicationTest extends AbstractFullDistribZkTestBase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -339,36 +334,19 @@ private void bringUpDeadNodeAndEnsureNoReplication( } private void waitTillNodesActive() throws Exception { - for (int i = 0; i < 60; i++) { - Thread.sleep(3000); - ZkStateReader zkStateReader = ZkStateReader.from(cloudClient); - ClusterState clusterState = zkStateReader.getClusterState(); - DocCollection collection1 = clusterState.getCollection("collection1"); - Slice slice = collection1.getSlice("shard1"); - Collection replicas = slice.getReplicas(); - boolean allActive = true; - - Collection nodesDownNames = - nodesDown.stream().map(n -> n.coreNodeName).collect(Collectors.toList()); - - Collection replicasToCheck = - replicas.stream() + ZkStateReader zkStateReader = ZkStateReader.from(cloudClient); + zkStateReader.waitForState( + "collection1", + 3, + TimeUnit.MINUTES, + (n, c) -> { + Collection nodesDownNames = + nodesDown.stream().map(runner -> runner.coreNodeName).collect(Collectors.toList()); + Collection replicas = c.getSlice("shard1").getReplicas(); + return replicas.stream() .filter(r -> !nodesDownNames.contains(r.getName())) - .collect(Collectors.toList()); - - for (Replica replica : replicasToCheck) { - if (!clusterState.liveNodesContain(replica.getNodeName()) - || replica.getState() != Replica.State.ACTIVE) { - allActive = false; - break; - } - } - if (allActive) { - return; - } - } - printLayout(); - fail("timeout waiting to see all nodes active"); + .allMatch(r -> r.getState() == Replica.State.ACTIVE && n.contains(r.getNodeName())); + }); } private List getOtherAvailableJetties(CloudJettyRunner leader) { diff --git a/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java b/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java index acf2a3b7f44..6394eb566e0 100644 --- a/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java @@ -16,13 +16,11 @@ */ package org.apache.solr.cloud; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.junit.Test; /* * Implementation moved to AbstractRecoveryZkTestBase as it is used by HDFS contrib tests. */ -@Slow public class RecoveryZkTest extends AbstractRecoveryZkTestBase { @Test diff --git a/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java b/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java index 85da4a37950..3a20e85d6aa 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java @@ -27,7 +27,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.apache.commons.lang3.StringUtils; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.JettySolrRunner; @@ -50,7 +49,6 @@ * Tests a client application's ability to get replication factor information back from the cluster * after an add or update. */ -@Slow @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") public class ReplicationFactorTest extends AbstractFullDistribZkTestBase { @@ -324,7 +322,7 @@ protected void testRf3() throws Exception { doDBIdWithRetry(2, 5, "deletes should have propagated to 2 replicas", 1); // SOLR-13599 sanity check if problem is related to sending a batch - List batch = new ArrayList(10); + List batch = new ArrayList(15); for (int i = 30; i < 45; i++) { SolrInputDocument doc = new SolrInputDocument(); doc.addField(id, String.valueOf(i)); diff --git a/solr/core/src/test/org/apache/solr/cloud/RestartWhileUpdatingTest.java b/solr/core/src/test/org/apache/solr/cloud/RestartWhileUpdatingTest.java index 3b2279849ef..1bc74fff254 100644 --- a/solr/core/src/test/org/apache/solr/cloud/RestartWhileUpdatingTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/RestartWhileUpdatingTest.java @@ -17,14 +17,12 @@ package org.apache.solr.cloud; import org.apache.lucene.tests.util.LuceneTestCase.Nightly; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.junit.Test; /** * Implementation moved to AbstractRestartWhileUpdatingTestBase because it is used by HDFS contrib * module tests */ -@Slow @Nightly public class RestartWhileUpdatingTest extends AbstractRestartWhileUpdatingTestBase { diff --git a/solr/core/src/test/org/apache/solr/cloud/SSLMigrationTest.java b/solr/core/src/test/org/apache/solr/cloud/SSLMigrationTest.java index e3c86a8be2f..e79ce92c345 100644 --- a/solr/core/src/test/org/apache/solr/cloud/SSLMigrationTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/SSLMigrationTest.java @@ -23,7 +23,6 @@ import java.util.Properties; import org.apache.commons.lang3.StringUtils; import org.apache.lucene.tests.util.LuceneTestCase.AwaitsFix; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.embedded.JettyConfig; @@ -44,7 +43,6 @@ * We want to make sure that when migrating between http and https modes the replicas will not be * rejoined as new nodes, but rather take off where it left off in the cluster. */ -@Slow @SuppressSSL @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-12028") // 17-Mar-2018 public class SSLMigrationTest extends AbstractFullDistribZkTestBase { diff --git a/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java b/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java index cda512936f5..bdff2a6a477 100644 --- a/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java @@ -16,19 +16,8 @@ */ package org.apache.solr.cloud; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; -import org.junit.Test; - /** * Test sync phase that occurs when Leader goes down and a new Leader is elected. Implementation * moved to AbstractSyncSliceTestBase.java as it is also used by the HDFS contrib tests. */ -@Slow -public class SyncSliceTest extends AbstractSyncSliceTestBase { - - @Test - @Override - public void test() throws Exception { - super.test(); - } -} +public class SyncSliceTest extends AbstractSyncSliceTestBase {} diff --git a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java index 8372c559176..3b9bdf1b434 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java @@ -22,7 +22,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.http.HttpRequestInterceptor; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.impl.BaseHttpSolrClient; import org.apache.solr.client.solrj.impl.CloudSolrClient; @@ -38,7 +37,6 @@ import org.slf4j.LoggerFactory; /** Test of the MiniSolrCloudCluster functionality with authentication enabled. */ -@LuceneTestCase.Slow public class TestAuthenticationFramework extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudPhrasesIdentificationComponent.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudPhrasesIdentificationComponent.java index cd969704fb8..c2666db605c 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestCloudPhrasesIdentificationComponent.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudPhrasesIdentificationComponent.java @@ -24,7 +24,6 @@ import java.util.List; import java.util.Map; import java.util.Random; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.embedded.JettySolrRunner; @@ -40,12 +39,11 @@ import org.junit.BeforeClass; /** - * A very simple sanity check that Phrase Identification works across a cloud cluster using - * distributed term stat collection. + * A very simple check that Phrase Identification works across a cloud cluster using distributed + * term stat collection. * * @see org.apache.solr.handler.component.PhrasesIdentificationComponentTest */ -@Slow public class TestCloudPhrasesIdentificationComponent extends SolrCloudTestCase { private static final String DEBUG_LABEL = MethodHandles.lookup().lookupClass().getName(); diff --git a/solr/core/src/test/org/apache/solr/cloud/TestLeaderElectionWithEmptyReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestLeaderElectionWithEmptyReplica.java index 6772ceac595..7de9a408e45 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestLeaderElectionWithEmptyReplica.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestLeaderElectionWithEmptyReplica.java @@ -49,8 +49,7 @@ public static void beforeClass() throws Exception { .configure(); CollectionAdminRequest.createCollection(COLLECTION_NAME, "config", 1, 1) - .processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT); - + .process(cluster.getSolrClient()); cluster.waitForActiveCollection(COLLECTION_NAME, 1, 1); } diff --git a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java index 04090868d64..a07e5173dab 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java @@ -33,7 +33,6 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.JettySolrRunner; @@ -65,7 +64,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow @LogLevel( "org.apache.solr.handler.ReplicationHandler=DEBUG;org.apache.solr.handler.IndexFetcher=DEBUG") public class TestPullReplica extends SolrCloudTestCase { diff --git a/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaWithAuth.java b/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaWithAuth.java index 75081234545..d87133dd35a 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaWithAuth.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaWithAuth.java @@ -28,7 +28,6 @@ import java.util.EnumSet; import java.util.List; import java.util.Map; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrRequest; import org.apache.solr.client.solrj.SolrResponse; @@ -50,7 +49,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow public class TestPullReplicaWithAuth extends SolrCloudTestCase { private static final String USER = "solr"; diff --git a/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java b/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java index 0dbc84b9322..611718964a3 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java @@ -29,7 +29,6 @@ import java.util.TreeSet; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.JettySolrRunner; import org.apache.solr.client.solrj.request.CollectionAdminRequest; @@ -51,7 +50,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@LuceneTestCase.Slow public class TestRebalanceLeaders extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final String COLLECTION_NAME = "TestColl"; @@ -135,8 +133,9 @@ public void testBalancePropertySliceUnique() } // We've moved on from a property being tested, we need to check if rebalancing the leaders - // actually chantges the leader appropriately. + // actually changes the leader appropriately. @Test + @Nightly public void testRebalanceLeaders() throws Exception { // First let's unbalance the preferredLeader property, do all the leaders get reassigned diff --git a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java index 62584324b39..7234809d690 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java @@ -30,7 +30,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicLong; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.SolrClient; @@ -68,7 +67,6 @@ * Optimistic Concurrency is not used here because of SOLR-8733, instead we just throw lots of "inc" * operations at a numeric field and check that the math works out at the end. */ -@Slow @SuppressSSL(bugUrl = "SSL overhead seems to cause OutOfMemory when stress testing") public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase { diff --git a/solr/core/src/test/org/apache/solr/cloud/TestStressInPlaceUpdates.java b/solr/core/src/test/org/apache/solr/cloud/TestStressInPlaceUpdates.java index 1a95c6c178a..bf862c84fcf 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestStressInPlaceUpdates.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestStressInPlaceUpdates.java @@ -29,7 +29,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import org.apache.commons.math3.primes.Primes; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.apache.solr.client.solrj.request.UpdateRequest; @@ -49,7 +48,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow public class TestStressInPlaceUpdates extends AbstractFullDistribZkTestBase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/core/src/test/org/apache/solr/cloud/TestStressLiveNodes.java b/solr/core/src/test/org/apache/solr/cloud/TestStressLiveNodes.java index 14f8c875012..fabdab37952 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestStressLiveNodes.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestStressLiveNodes.java @@ -24,7 +24,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.client.solrj.impl.CloudSolrClient; import org.apache.solr.common.cloud.SolrZkClient; @@ -44,7 +44,7 @@ * a ZkStateReader detects the correct set. */ @ThreadLeakLingering(linger = 10) -@Slow +@LuceneTestCase.Nightly public class TestStressLiveNodes extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java index 6b64278bb3f..c11160aab65 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java @@ -38,7 +38,6 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.lucene.index.IndexWriter; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; @@ -77,7 +76,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow public class TestTlogReplica extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -766,6 +764,7 @@ public void testBasicLeaderElection() throws Exception { waitForNumDocsInAllActiveReplicas(4, 0); } + @Nightly public void testRebalanceLeaders() throws Exception { createAndWaitForCollection(1, 0, 2, 0); CloudSolrClient cloudClient = cluster.getSolrClient(); diff --git a/solr/core/src/test/org/apache/solr/cloud/TlogReplayBufferedWhileIndexingTest.java b/solr/core/src/test/org/apache/solr/cloud/TlogReplayBufferedWhileIndexingTest.java index ec1bad7ce52..e056c40a893 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TlogReplayBufferedWhileIndexingTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/TlogReplayBufferedWhileIndexingTest.java @@ -17,11 +17,9 @@ package org.apache.solr.cloud; import org.apache.lucene.tests.util.LuceneTestCase.Nightly; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.junit.Test; -@Slow @Nightly @SuppressSSL /* diff --git a/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java index 9c42c25b246..30d3f884b97 100644 --- a/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java @@ -16,29 +16,12 @@ */ package org.apache.solr.cloud; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; -import org.junit.Test; /** * This test simply does a bunch of basic things in solrcloud mode and asserts things work as * expected. Implementation moved to AbstractUnloadDistributedZkTestBase as it is used by HDFS * contrib module tests. */ -@Slow @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") -public class UnloadDistributedZkTest extends AbstractUnloadDistributedZkTestBase { - public UnloadDistributedZkTest() { - super(); - } - - protected String getSolrXml() { - return "solr.xml"; - } - - @Test - @Override - public void test() throws Exception { - super.test(); - } -} +public class UnloadDistributedZkTest extends AbstractUnloadDistributedZkTestBase {} diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java index 2eaf6f7ef1c..b675541e15b 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java @@ -29,7 +29,6 @@ import java.util.Properties; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.cloud.ClusterProperties; import org.apache.solr.common.cloud.SolrZkClient; @@ -54,7 +53,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow @SolrTestCaseJ4.SuppressSSL public class ZkControllerTest extends SolrTestCaseJ4 { @@ -206,7 +204,6 @@ public void testGetHostName() throws Exception { } } - @Slow @LogLevel(value = "org.apache.solr.cloud=DEBUG;org.apache.solr.cloud.overseer=DEBUG") public void testPublishAndWaitForDownStates() throws Exception { diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionTooManyReplicasTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionTooManyReplicasTest.java index 67de4ee78ba..eb44e2588df 100644 --- a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionTooManyReplicasTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionTooManyReplicasTest.java @@ -19,7 +19,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.embedded.JettySolrRunner; import org.apache.solr.client.solrj.request.CollectionAdminRequest; import org.apache.solr.cloud.SolrCloudTestCase; @@ -31,7 +30,6 @@ import org.junit.Ignore; import org.junit.Test; -@Slow public class CollectionTooManyReplicasTest extends SolrCloudTestCase { @BeforeClass diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.java index 600b9389659..0807a3ce9bc 100644 --- a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.java @@ -24,7 +24,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; @@ -48,7 +47,6 @@ import org.slf4j.LoggerFactory; /** Tests the Cloud Collections API. */ -@Slow public class CollectionsAPIAsyncDistributedZkTest extends SolrCloudTestCase { private static final int MAX_TIMEOUT_SECONDS = 90; @@ -58,16 +56,13 @@ public class CollectionsAPIAsyncDistributedZkTest extends SolrCloudTestCase { @Before public void setupCluster() throws Exception { // we recreate per test - they need to be isolated to be solid - configureCluster(2) - .addConfig( - "conf1", TEST_PATH().resolve("configsets").resolve("cloud-minimal").resolve("conf")) - .configure(); + configureCluster(2).addConfig("conf1", configset("cloud-minimal")).configure(); } @After public void tearDown() throws Exception { - super.tearDown(); shutdownCluster(); + super.tearDown(); } @Test diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistributedZkTest.java index 01c0e9f1325..11c04c976cd 100644 --- a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistributedZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistributedZkTest.java @@ -16,13 +16,16 @@ */ package org.apache.solr.cloud.api.collections; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import org.junit.BeforeClass; /** Tests the Cloud Collections API. */ -@Slow public class CollectionsAPIDistributedZkTest extends AbstractCollectionsAPIDistributedZkTestBase { - - protected String getConfigSet() { - return "cloud-minimal"; + @BeforeClass + public static void createCluster() throws Exception { + configureCluster(4) + .addConfig("conf", configset("cloud-minimal")) + .addConfig("conf2", configset("cloud-minimal")) + .withSolrXml(TEST_PATH().resolve("solr.xml")) + .configure(); } } diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/ReplicaPropertiesBase.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/ReplicaPropertiesBase.java index 0bc08628eb8..15dce24bfc9 100644 --- a/solr/core/src/test/org/apache/solr/cloud/api/collections/ReplicaPropertiesBase.java +++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/ReplicaPropertiesBase.java @@ -40,9 +40,8 @@ public abstract class ReplicaPropertiesBase extends AbstractFullDistribZkTestBas public static NamedList doPropertyAction(CloudSolrClient client, String... paramsIn) throws IOException, SolrServerException { - assertTrue( - "paramsIn must be an even multiple of 2, it is: " + paramsIn.length, - (paramsIn.length % 2) == 0); + assertEquals( + "paramsIn must be a multiple of 2, it is: " + paramsIn.length, 0, (paramsIn.length % 2)); ModifiableSolrParams params = new ModifiableSolrParams(); for (int idx = 0; idx < paramsIn.length; idx += 2) { params.set(paramsIn[idx], paramsIn[idx + 1]); diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/ShardSplitTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/ShardSplitTest.java index 96ee4c63a31..68cdbd0338f 100644 --- a/solr/core/src/test/org/apache/solr/cloud/api/collections/ShardSplitTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/ShardSplitTest.java @@ -34,7 +34,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.JettySolrRunner; @@ -75,7 +75,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow +@LuceneTestCase.Nightly @LogLevel( "org.apache.solr.cloud.Overseer=DEBUG;org.apache.solr.cloud.overseer=DEBUG;org.apache.solr.cloud.api.collections=DEBUG;org.apache.solr.cloud.OverseerTaskProcessor=DEBUG;org.apache.solr.util.TestInjection=DEBUG") public class ShardSplitTest extends BasicDistributedZkTest { diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java index 9136f649ade..ca10867f986 100644 --- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java +++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java @@ -25,7 +25,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.embedded.JettySolrRunner; import org.apache.solr.client.solrj.impl.CloudSolrClient; @@ -43,7 +42,6 @@ import org.junit.Test; /** Test of the Collections API with the MiniSolrCloudCluster. */ -@LuceneTestCase.Slow public class TestCollectionsAPIViaSolrCloudCluster extends SolrCloudTestCase { private static final int numShards = 2; diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java index 656597aa549..11a5dde4612 100644 --- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java +++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java @@ -20,7 +20,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.CloudSolrClient; import org.apache.solr.client.solrj.request.QueryRequest; @@ -34,7 +33,6 @@ import org.apache.solr.common.util.NamedList; import org.junit.Test; -@Slow public class TestReplicaProperties extends ReplicaPropertiesBase { public static final String COLLECTION_NAME = "testcollection"; @@ -51,10 +49,8 @@ public void test() throws Exception { try (CloudSolrClient client = createCloudClient(null)) { // Mix up a bunch of different combinations of shards and replicas in order to exercise // boundary cases. shards, replicationFactor - int shards = random().nextInt(7); - if (shards < 2) shards = 2; - int replicationFactor = random().nextInt(4); - if (replicationFactor < 2) replicationFactor = 2; + int shards = random().nextInt(5) + 2; + int replicationFactor = random().nextInt(2) + 2; createCollection(null, COLLECTION_NAME, shards, replicationFactor, client, null, "conf1"); } @@ -156,7 +152,7 @@ private void clusterAssignPropertyTest() throws Exception { String c1_s1_r1 = replicasList.get(0); String c1_s1_r2 = replicasList.get(1); - addProperty( + ReplicaPropertiesBase.doPropertyAction( client, "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(), @@ -171,7 +167,7 @@ private void clusterAssignPropertyTest() throws Exception { "property.value", "true"); - addProperty( + ReplicaPropertiesBase.doPropertyAction( client, "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(), @@ -190,7 +186,7 @@ private void clusterAssignPropertyTest() throws Exception { assertThrows( SolrException.class, () -> - doPropertyAction( + ReplicaPropertiesBase.doPropertyAction( client, "action", CollectionParams.CollectionAction.BALANCESHARDUNIQUE.toString(), @@ -281,18 +277,4 @@ private void verifyLeaderAssignment(CloudSolrClient client, String collectionNam } fail(lastFailMsg); } - - private void addProperty(CloudSolrClient client, String... paramsIn) - throws IOException, SolrServerException { - assertTrue( - "paramsIn must be an even multiple of 2, it is: " + paramsIn.length, - (paramsIn.length % 2) == 0); - ModifiableSolrParams params = new ModifiableSolrParams(); - for (int idx = 0; idx < paramsIn.length; idx += 2) { - params.set(paramsIn[idx], paramsIn[idx + 1]); - } - QueryRequest request = new QueryRequest(params); - request.setPath("/admin/collections"); - client.request(request); - } } diff --git a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkCollectionPropsCachingTest.java b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkCollectionPropsCachingTest.java index 8e50593e799..f89e4ad54d5 100644 --- a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkCollectionPropsCachingTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkCollectionPropsCachingTest.java @@ -18,7 +18,6 @@ package org.apache.solr.cloud.overseer; import java.io.IOException; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.request.CollectionAdminRequest; import org.apache.solr.client.solrj.response.CollectionAdminResponse; @@ -29,7 +28,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@LuceneTestCase.Slow @SolrTestCaseJ4.SuppressSSL public class ZkCollectionPropsCachingTest extends SolrCloudTestCase { // diff --git a/solr/core/src/test/org/apache/solr/cluster/placement/plugins/AffinityPlacementFactoryTest.java b/solr/core/src/test/org/apache/solr/cluster/placement/plugins/AffinityPlacementFactoryTest.java index 73a81c41c99..40d04aa8e64 100644 --- a/solr/core/src/test/org/apache/solr/cluster/placement/plugins/AffinityPlacementFactoryTest.java +++ b/solr/core/src/test/org/apache/solr/cluster/placement/plugins/AffinityPlacementFactoryTest.java @@ -1067,7 +1067,6 @@ public void testNodeType() throws Exception { } @Test - @Slow public void testScalability() throws Exception { // for non-nightly we scale a bit, but retain test speed - for nightly test speed can be 2+ // minutes @@ -1089,8 +1088,10 @@ public void testScalability() throws Exception { runTestScalability(numNodes, 100, nrtReplicas, tlogReplicas, pullReplicas); runTestScalability(numNodes, 200, nrtReplicas, tlogReplicas, pullReplicas); runTestScalability(numNodes, 500, nrtReplicas, tlogReplicas, pullReplicas); - runTestScalability(numNodes, 1000, nrtReplicas, tlogReplicas, pullReplicas); - runTestScalability(numNodes, 2000, nrtReplicas, tlogReplicas, pullReplicas); + if (TEST_NIGHTLY) { + runTestScalability(numNodes, 1000, nrtReplicas, tlogReplicas, pullReplicas); + runTestScalability(numNodes, 2000, nrtReplicas, tlogReplicas, pullReplicas); + } log.info("==== numReplicas ===="); runTestScalability(numNodes, numShards, TEST_NIGHTLY ? 100 : 10, 0, 0); diff --git a/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCloudSnapshots.java b/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCloudSnapshots.java index e50d3b8caf9..ee248178e21 100644 --- a/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCloudSnapshots.java +++ b/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCloudSnapshots.java @@ -25,7 +25,6 @@ import java.util.function.Function; import java.util.stream.Collectors; import org.apache.lucene.tests.util.LuceneTestCase; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.SolrClient; @@ -60,7 +59,7 @@ // Backups do checksum validation against a footer value not present in 'SimpleText' @LuceneTestCase.SuppressCodecs({"SimpleText"}) @SolrTestCaseJ4.SuppressSSL // Currently, unknown why SSL does not work with this test -@Slow +@LuceneTestCase.Nightly public class TestSolrCloudSnapshots extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static long docsSeed; // see indexDocs() diff --git a/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCoreSnapshots.java b/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCoreSnapshots.java index a7648e09945..93d74aecfbd 100644 --- a/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCoreSnapshots.java +++ b/solr/core/src/test/org/apache/solr/core/snapshots/TestSolrCoreSnapshots.java @@ -30,7 +30,6 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.NIOFSDirectory; import org.apache.lucene.tests.util.LuceneTestCase; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.SolrClient; @@ -63,7 +62,6 @@ // Backups do checksum validation against a footer value not present in 'SimpleText' @LuceneTestCase.SuppressCodecs({"SimpleText"}) @SolrTestCaseJ4.SuppressSSL // Currently, unknown why SSL does not work with this test -@Slow public class TestSolrCoreSnapshots extends SolrCloudTestCase { private static long docsSeed; // see indexDocs() diff --git a/solr/core/src/test/org/apache/solr/handler/TestHealthCheckHandlerLegacyMode.java b/solr/core/src/test/org/apache/solr/handler/TestHealthCheckHandlerLegacyMode.java index 2c2fd87e209..4027c14a597 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestHealthCheckHandlerLegacyMode.java +++ b/solr/core/src/test/org/apache/solr/handler/TestHealthCheckHandlerLegacyMode.java @@ -25,7 +25,6 @@ import static org.apache.solr.handler.ReplicationTestHelper.rQuery; import java.io.IOException; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.embedded.JettySolrRunner; @@ -40,7 +39,6 @@ import org.junit.Test; /** Test for HealthCheckHandler in legacy mode */ -@Slow @SuppressSSL // Currently, unknown why SSL does not work with this test public class TestHealthCheckHandlerLegacyMode extends SolrTestCaseJ4 { HttpSolrClient leaderClientHealthCheck, followerClientHealthCheck; diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java index ff08ae8812d..ec3a681a054 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java +++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java @@ -42,7 +42,7 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.store.NIOFSDirectory; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import org.apache.lucene.tests.util.LuceneTestCase.Nightly; import org.apache.lucene.tests.util.TestUtil; import org.apache.lucene.util.Constants; import org.apache.solr.BaseDistributedSearchTestCase; @@ -91,7 +91,7 @@ * * @since 1.4 */ -@Slow +@Nightly @SuppressSSL // Currently, unknown why SSL does not work with this test public class TestReplicationHandler extends SolrTestCaseJ4 { diff --git a/solr/core/src/test/org/apache/solr/handler/TestStressIncrementalBackup.java b/solr/core/src/test/org/apache/solr/handler/TestStressIncrementalBackup.java index b583dcb789b..2f6cb29988d 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestStressIncrementalBackup.java +++ b/solr/core/src/test/org/apache/solr/handler/TestStressIncrementalBackup.java @@ -38,7 +38,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -// @LuceneTestCase.Nightly +@LuceneTestCase.Nightly @LuceneTestCase.SuppressCodecs({"SimpleText"}) public class TestStressIncrementalBackup extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -56,10 +56,7 @@ public void beforeTest() throws Exception { // bring myself to deal with the nonsense that is SolrJettyTestBase. // We do however explicitly want a fresh "cluster" every time a test is run - configureCluster(1) - .addConfig( - "conf1", TEST_PATH().resolve("configsets").resolve("cloud-minimal").resolve("conf")) - .configure(); + configureCluster(1).addConfig("conf1", configset("cloud-minimal")).configure(); assertEquals( 0, diff --git a/solr/core/src/test/org/apache/solr/handler/component/CustomHighlightComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/CustomHighlightComponentTest.java index c6bb670a5b3..aebb03d5a48 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/CustomHighlightComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/CustomHighlightComponentTest.java @@ -116,7 +116,7 @@ public static void setupCluster() throws Exception { // create an empty collection CollectionAdminRequest.createCollection(COLLECTION, "conf", numShards, numReplicas) - .processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT); + .process(cluster.getSolrClient()); AbstractDistribZkTestBase.waitForRecoveriesToFinish( COLLECTION, cluster.getZkStateReader(), false, true, DEFAULT_TIMEOUT); } diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java index 1b66c847b4f..bf803e3b2b1 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java @@ -18,7 +18,6 @@ import java.util.HashMap; import java.util.Map; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.BaseDistributedSearchTestCase; import org.apache.solr.client.solrj.response.QueryResponse; @@ -38,7 +37,6 @@ * @since solr 4.1 * @see org.apache.solr.handler.component.MoreLikeThisComponent */ -@Slow public class DistributedMLTComponentTest extends BaseDistributedSearchTestCase { private String requestHandlerName; diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java index 83aea9e73cb..72dc30a4c79 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java @@ -20,7 +20,6 @@ import java.util.Arrays; import java.util.List; import junit.framework.Assert; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.LuceneTestCase.SuppressTempFileChecks; import org.apache.solr.BaseDistributedSearchTestCase; import org.apache.solr.client.solrj.SolrClient; @@ -37,18 +36,10 @@ * @since solr 1.5 * @see org.apache.solr.handler.component.SpellCheckComponent */ -@Slow @SuppressTempFileChecks( bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?") public class DistributedSpellCheckComponentTest extends BaseDistributedSearchTestCase { - public DistributedSpellCheckComponentTest() { - // Helpful for debugging - // fixShardCount=true; - // shardCount=2; - // stress=0; - } - @BeforeClass public static void beforeClass() throws Exception { useFactory(null); // need an FS factory diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedSuggestComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedSuggestComponentTest.java index e84c62cf086..21ebf91d5e1 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/DistributedSuggestComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedSuggestComponentTest.java @@ -20,7 +20,6 @@ import java.util.Arrays; import java.util.List; import junit.framework.Assert; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.BaseDistributedSearchTestCase; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.util.NamedList; @@ -34,7 +33,6 @@ * * @see org.apache.solr.handler.component.SuggestComponent */ -@Slow public class DistributedSuggestComponentTest extends BaseDistributedSearchTestCase { public DistributedSuggestComponentTest() { diff --git a/solr/core/src/test/org/apache/solr/handler/component/MoreLikeThisComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/MoreLikeThisComponentTest.java index 28e8f817f57..e11d9b570f8 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/MoreLikeThisComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/MoreLikeThisComponentTest.java @@ -16,7 +16,6 @@ */ package org.apache.solr.handler.component; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.params.CommonParams; import org.apache.solr.common.params.ModifiableSolrParams; @@ -32,7 +31,6 @@ * * @see MoreLikeThisComponent */ -@Slow public class MoreLikeThisComponentTest extends SolrTestCaseJ4 { @BeforeClass diff --git a/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java index 7ae66153096..56911b30a05 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java @@ -19,7 +19,6 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.LuceneTestCase.SuppressTempFileChecks; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.SolrException; @@ -41,7 +40,6 @@ /** * @since solr 1.3 */ -@Slow @SuppressTempFileChecks( bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?") public class SpellCheckComponentTest extends SolrTestCaseJ4 { @@ -71,10 +69,9 @@ public void setUp() throws Exception { @Override public void tearDown() throws Exception { - super.tearDown(); assertU(delQ("*:*")); - optimize(); assertU((commit())); + super.tearDown(); } @Test diff --git a/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java b/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java index 85bcf56d1b5..58fa1736db2 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java +++ b/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java @@ -27,7 +27,6 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.IntStream; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.BaseDistributedSearchTestCase; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; @@ -36,14 +35,12 @@ import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.params.SolrParams; -import org.apache.solr.util.LogLevel; import org.apache.solr.util.hll.HLL; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-9062") -@LogLevel("org.eclipse.jetty.client.HttpConnection=DEBUG") +// @LogLevel("org.eclipse.jetty.client.HttpConnection=DEBUG") public class TestDistributedStatsComponentCardinality extends BaseDistributedSearchTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -161,8 +158,7 @@ public void test() throws Exception { Map stats = rsp.getFieldStatsInfo(); if (Boolean.getBoolean(NUMERIC_POINTS_SYSPROP)) { - log.warn( - "SOLR-10918: can't relying on exact match with pre-hashed values when using points"); + // SOLR-10918: can't rely on exact match with pre-hashed values when using points } else { for (String f : STAT_FIELDS) { // regardless of log2m and regwidth, the estimated cardinality of the diff --git a/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.java b/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.java index 9154044d046..6221f424d93 100644 --- a/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.java +++ b/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.java @@ -309,7 +309,6 @@ public void testWithFieldCache() { } @Test - @Slow public void testRandom() throws Exception { // All field values will be a number between 0 and cardinality int cardinality = 10000; @@ -350,7 +349,8 @@ public void testRandom() throws Exception { "test_ds_p", "test_dts_p" }; - for (int i = 0; i < atLeast(500); i++) { + int docs = atLeast(500); + for (int i = 0; i < docs; i++) { if (random().nextInt(50) == 0) { // have some empty docs assertU(adoc("id", String.valueOf(i))); @@ -399,7 +399,9 @@ public void testRandom() throws Exception { } assertU(commit()); - for (int i = 0; i < atLeast(10000); i++) { + // Scale higher for nightlies than typically + int queries = TEST_NIGHTLY ? atLeast(10000) : atLeast(1000); + for (int i = 0; i < queries; i++) { doTestQuery(cardinality, fields); } } diff --git a/solr/core/src/test/org/apache/solr/rest/TestManagedFileStorage.java b/solr/core/src/test/org/apache/solr/rest/TestManagedFileStorage.java new file mode 100644 index 00000000000..8c0fce60c3c --- /dev/null +++ b/solr/core/src/test/org/apache/solr/rest/TestManagedFileStorage.java @@ -0,0 +1,105 @@ +/* + * 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.rest; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.solr.SolrTestCaseJ4; +import org.apache.solr.common.util.NamedList; +import org.apache.solr.core.SolrResourceLoader; +import org.apache.solr.rest.ManagedResourceStorage.FileStorageIO; +import org.apache.solr.rest.ManagedResourceStorage.JsonStorage; +import org.apache.solr.rest.ManagedResourceStorage.StorageIO; +import org.junit.Test; + +public class TestManagedFileStorage extends SolrTestCaseJ4 { + + /** Runs persisted managed resource creation and update tests on JSON storage. */ + @Test + public void testFileBasedJsonStorage() throws Exception { + File instanceDir = createTempDir("json-storage").toFile(); + try (SolrResourceLoader loader = new SolrResourceLoader(instanceDir.toPath())) { + NamedList initArgs = new NamedList<>(); + String managedDir = instanceDir.getAbsolutePath() + File.separator + "managed"; + initArgs.add(ManagedResourceStorage.STORAGE_DIR_INIT_ARG, managedDir); + FileStorageIO fileStorageIO = new FileStorageIO(); + fileStorageIO.configure(loader, initArgs); + TestManagedFileStorage.doStorageTests(loader, fileStorageIO); + } + } + + /** + * Called from tests for each storage type to run creation and update tests on a persisted managed + * resource. + */ + @SuppressWarnings("unchecked") + public static void doStorageTests(SolrResourceLoader loader, StorageIO storageIO) + throws Exception { + String resourceId = "/test/foo"; + + JsonStorage jsonStorage = new JsonStorage(storageIO, loader); + + Map managedInitArgs = new HashMap<>(); + managedInitArgs.put("ignoreCase", "true"); + managedInitArgs.put("dontIgnoreCase", "false"); + + List managedList = new ArrayList<>(); // we need a mutable List for this test + managedList.addAll(Arrays.asList("a", "b", "c", "d", "e")); + + Map toStore = new HashMap<>(); + toStore.put(ManagedResource.INIT_ARGS_JSON_FIELD, managedInitArgs); + toStore.put(ManagedResource.MANAGED_JSON_LIST_FIELD, managedList); + + jsonStorage.store(resourceId, toStore); + + String storedResourceId = jsonStorage.getStoredResourceId(resourceId); + assertTrue(storedResourceId + " file not found!", storageIO.exists(storedResourceId)); + + Object fromStorage = jsonStorage.load(resourceId); + assertNotNull(fromStorage); + + Map storedMap = (Map) fromStorage; + Map storedArgs = + (Map) storedMap.get(ManagedResource.INIT_ARGS_JSON_FIELD); + assertNotNull(storedArgs); + assertEquals("true", storedArgs.get("ignoreCase")); + List storedList = (List) storedMap.get(ManagedResource.MANAGED_JSON_LIST_FIELD); + assertNotNull(storedList); + assertEquals(managedList.size(), storedList.size()); + assertTrue(storedList.contains("a")); + + // now verify you can update existing data + managedInitArgs.put("anotherArg", "someValue"); + managedList.add("f"); + jsonStorage.store(resourceId, toStore); + fromStorage = jsonStorage.load(resourceId); + assertNotNull(fromStorage); + + storedMap = (Map) fromStorage; + storedArgs = (Map) storedMap.get(ManagedResource.INIT_ARGS_JSON_FIELD); + assertNotNull(storedArgs); + assertEquals("someValue", storedArgs.get("anotherArg")); + storedList = (List) storedMap.get(ManagedResource.MANAGED_JSON_LIST_FIELD); + assertNotNull(storedList); + assertEquals(managedList.size(), storedList.size()); + assertTrue(storedList.contains("f")); + } +} diff --git a/solr/core/src/test/org/apache/solr/rest/TestManagedResourceStorage.java b/solr/core/src/test/org/apache/solr/rest/TestManagedResourceStorage.java index c3e66ba33db..766d7bbec3c 100644 --- a/solr/core/src/test/org/apache/solr/rest/TestManagedResourceStorage.java +++ b/solr/core/src/test/org/apache/solr/rest/TestManagedResourceStorage.java @@ -16,116 +16,28 @@ */ package org.apache.solr.rest; -import java.io.File; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import java.nio.file.Path; +import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.cloud.AbstractZkTestCase; import org.apache.solr.common.util.NamedList; import org.apache.solr.core.SolrResourceLoader; -import org.apache.solr.rest.ManagedResourceStorage.FileStorageIO; -import org.apache.solr.rest.ManagedResourceStorage.JsonStorage; -import org.apache.solr.rest.ManagedResourceStorage.StorageIO; import org.apache.solr.rest.ManagedResourceStorage.ZooKeeperStorageIO; import org.junit.Test; /** Depends on ZK for testing ZooKeeper backed storage logic. */ -@Slow +@LuceneTestCase.Nightly public class TestManagedResourceStorage extends AbstractZkTestCase { /** Runs persisted managed resource creation and update tests on Zookeeper storage. */ @Test public void testZkBasedJsonStorage() throws Exception { - // test using ZooKeeper assertTrue("Not using ZooKeeper", h.getCoreContainer().isZooKeeperAware()); - SolrResourceLoader loader = new SolrResourceLoader(Paths.get("./")); - // Solr unit tests can only write to their working directory due to - // a custom Java Security Manager installed in the test environment - NamedList initArgs = new NamedList<>(); - try { + Path instanceDir = createTempDir("zk-storage"); + try (SolrResourceLoader loader = new SolrResourceLoader(instanceDir)) { ZooKeeperStorageIO zkStorageIO = new ZooKeeperStorageIO(zkServer.getZkClient(), "/test"); - zkStorageIO.configure(loader, initArgs); - doStorageTests(loader, zkStorageIO); - } finally { - loader.close(); - } - } - - /** Runs persisted managed resource creation and update tests on JSON storage. */ - @Test - public void testFileBasedJsonStorage() throws Exception { - File instanceDir = createTempDir("json-storage").toFile(); - SolrResourceLoader loader = new SolrResourceLoader(instanceDir.toPath()); - try { - NamedList initArgs = new NamedList<>(); - String managedDir = instanceDir.getAbsolutePath() + File.separator + "managed"; - initArgs.add(ManagedResourceStorage.STORAGE_DIR_INIT_ARG, managedDir); - FileStorageIO fileStorageIO = new FileStorageIO(); - fileStorageIO.configure(loader, initArgs); - doStorageTests(loader, fileStorageIO); - } finally { - loader.close(); + zkStorageIO.configure(loader, new NamedList<>()); + TestManagedFileStorage.doStorageTests(loader, zkStorageIO); } } - - /** - * Called from tests for each storage type to run creation and update tests on a persisted managed - * resource. - */ - @SuppressWarnings("unchecked") - private void doStorageTests(SolrResourceLoader loader, StorageIO storageIO) throws Exception { - String resourceId = "/test/foo"; - - JsonStorage jsonStorage = new JsonStorage(storageIO, loader); - - Map managedInitArgs = new HashMap<>(); - managedInitArgs.put("ignoreCase", "true"); - managedInitArgs.put("dontIgnoreCase", "false"); - - List managedList = new ArrayList<>(); // we need a mutable List for this test - managedList.addAll(Arrays.asList("a", "b", "c", "d", "e")); - - Map toStore = new HashMap<>(); - toStore.put(ManagedResource.INIT_ARGS_JSON_FIELD, managedInitArgs); - toStore.put(ManagedResource.MANAGED_JSON_LIST_FIELD, managedList); - - jsonStorage.store(resourceId, toStore); - - String storedResourceId = jsonStorage.getStoredResourceId(resourceId); - assertTrue(storedResourceId + " file not found!", storageIO.exists(storedResourceId)); - - Object fromStorage = jsonStorage.load(resourceId); - assertNotNull(fromStorage); - - Map storedMap = (Map) fromStorage; - Map storedArgs = - (Map) storedMap.get(ManagedResource.INIT_ARGS_JSON_FIELD); - assertNotNull(storedArgs); - assertEquals("true", storedArgs.get("ignoreCase")); - List storedList = (List) storedMap.get(ManagedResource.MANAGED_JSON_LIST_FIELD); - assertNotNull(storedList); - assertTrue(storedList.size() == managedList.size()); - assertTrue(storedList.contains("a")); - - // now verify you can update existing data - managedInitArgs.put("anotherArg", "someValue"); - managedList.add("f"); - jsonStorage.store(resourceId, toStore); - fromStorage = jsonStorage.load(resourceId); - assertNotNull(fromStorage); - - storedMap = (Map) fromStorage; - storedArgs = (Map) storedMap.get(ManagedResource.INIT_ARGS_JSON_FIELD); - assertNotNull(storedArgs); - assertEquals("someValue", storedArgs.get("anotherArg")); - storedList = (List) storedMap.get(ManagedResource.MANAGED_JSON_LIST_FIELD); - assertNotNull(storedList); - assertTrue(storedList.size() == managedList.size()); - assertTrue(storedList.contains("e")); - } } diff --git a/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java b/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java index af908951be8..2bb9d09adb4 100644 --- a/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java +++ b/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored.java @@ -187,7 +187,8 @@ public void testDuplicateMultiValued() { @Test public void testRandomSingleAndMultiValued() throws Exception { - for (int c = 0; c < 10 * RANDOM_MULTIPLIER; ++c) { + int iterations = atLeast(5); + for (int c = 0; c < iterations; ++c) { clearIndex(); int[] arity = new int[9]; for (int a = 0; a < arity.length; ++a) { @@ -252,7 +253,7 @@ private String dvStringFieldName(int arity, boolean indexed, boolean stored) { if (indexed && stored) suffix = "_dv"; else if (indexed && !stored) suffix = "_dvo"; else if (!indexed && !stored) suffix = "_dvo2"; - else assertTrue("unsupported dv string field combination: stored and not indexed", false); + else fail("unsupported dv string field combination: stored and not indexed"); return base + suffix; } diff --git a/solr/core/src/test/org/apache/solr/search/TestSolrCachePerf.java b/solr/core/src/test/org/apache/solr/search/TestSolrCachePerf.java index 1bca6a2ff8c..84d49d22f3b 100644 --- a/solr/core/src/test/org/apache/solr/search/TestSolrCachePerf.java +++ b/solr/core/src/test/org/apache/solr/search/TestSolrCachePerf.java @@ -26,7 +26,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.math3.stat.descriptive.SummaryStatistics; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.metrics.SolrMetricManager; import org.apache.solr.metrics.SolrMetricsContext; @@ -35,7 +34,6 @@ import org.junit.runners.model.MultipleFailureException; /** */ -@LuceneTestCase.Slow public class TestSolrCachePerf extends SolrTestCaseJ4 { @SuppressWarnings({"unchecked", "rawtypes"}) diff --git a/solr/core/src/test/org/apache/solr/search/facet/TestCloudJSONFacetSKG.java b/solr/core/src/test/org/apache/solr/search/facet/TestCloudJSONFacetSKG.java index 96f9f47d4af..df2f544330d 100644 --- a/solr/core/src/test/org/apache/solr/search/facet/TestCloudJSONFacetSKG.java +++ b/solr/core/src/test/org/apache/solr/search/facet/TestCloudJSONFacetSKG.java @@ -31,7 +31,6 @@ import java.util.Map; import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrServerException; @@ -76,7 +75,6 @@ * @see TestCloudJSONFacetJoinDomain * @see TestCloudJSONFacetSKGEquiv */ -@Slow public class TestCloudJSONFacetSKG extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java index c17528f7207..6e61334ad79 100644 --- a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java +++ b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java @@ -111,12 +111,19 @@ public static void afterTests() throws Exception { @ParametersFactory public static Iterable parameters() { if (null != TEST_ONLY_ONE_FACET_METHOD) { - return Arrays.asList(new Object[] {TEST_ONLY_ONE_FACET_METHOD}); + return Collections.singleton(new Object[] {TEST_ONLY_ONE_FACET_METHOD}); + } else if (TEST_NIGHTLY) { + // wrap each enum val in an Object[] and return as Iterable + return () -> + Arrays.stream(FacetField.FacetMethod.values()).map(it -> new Object[] {it}).iterator(); + } else { + // pick a single random method and test it + FacetField.FacetMethod[] methods = FacetField.FacetMethod.values(); + + // can't use LuceneTestCase.random() because we're not in the runner context yet + String seed = System.getProperty("tests.seed", ""); + return Collections.singleton(new Object[] {methods[seed.hashCode() % methods.length]}); } - - // wrap each enum val in an Object[] and return as Iterable - return () -> - Arrays.stream(FacetField.FacetMethod.values()).map(it -> new Object[] {it}).iterator(); } public TestJsonFacets(FacetField.FacetMethod defMethod) { diff --git a/solr/core/src/test/org/apache/solr/search/mlt/CloudMLTQParserTest.java b/solr/core/src/test/org/apache/solr/search/mlt/CloudMLTQParserTest.java index 6c6b03c07e8..91975464372 100644 --- a/solr/core/src/test/org/apache/solr/search/mlt/CloudMLTQParserTest.java +++ b/solr/core/src/test/org/apache/solr/search/mlt/CloudMLTQParserTest.java @@ -39,9 +39,7 @@ public void setupCluster() throws Exception { final CloudSolrClient client = cluster.getSolrClient(); - CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1) - .processAndWait(client, DEFAULT_TIMEOUT); - + CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1).process(client); cluster.waitForActiveCollection(COLLECTION, 2, 2); String id = "id"; diff --git a/solr/core/src/test/org/apache/solr/security/TestAuthorizationFramework.java b/solr/core/src/test/org/apache/solr/security/TestAuthorizationFramework.java index 67b1bc79047..81d2dfbafc1 100644 --- a/solr/core/src/test/org/apache/solr/security/TestAuthorizationFramework.java +++ b/solr/core/src/test/org/apache/solr/security/TestAuthorizationFramework.java @@ -20,13 +20,11 @@ import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.concurrent.TimeUnit; import java.util.function.Predicate; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.util.EntityUtils; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.client.solrj.impl.CloudLegacySolrClient; import org.apache.solr.client.solrj.impl.HttpClientUtil; import org.apache.solr.cloud.AbstractFullDistribZkTestBase; @@ -39,10 +37,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@LuceneTestCase.Slow public class TestAuthorizationFramework extends AbstractFullDistribZkTestBase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + public static final byte[] SECURITY_JSON = + "{\"authorization\":{\"class\":\"org.apache.solr.security.MockAuthorizationPlugin\"}}" + .getBytes(StandardCharsets.UTF_8); + static final int TIMEOUT = 10000; public void distribSetUp() throws Exception { @@ -52,54 +53,44 @@ public void distribSetUp() throws Exception { zkStateReader .getZkClient() .create( - ZkStateReader.SOLR_SECURITY_CONF_PATH, - "{\"authorization\":{\"class\":\"org.apache.solr.security.MockAuthorizationPlugin\"}}" - .getBytes(StandardCharsets.UTF_8), - CreateMode.PERSISTENT, - true); + ZkStateReader.SOLR_SECURITY_CONF_PATH, SECURITY_JSON, CreateMode.PERSISTENT, true); } } @Test public void authorizationFrameworkTest() throws Exception { MockAuthorizationPlugin.denyUsers.add("user1"); - MockAuthorizationPlugin.denyUsers.add("user1"); - try { - waitForThingsToLevelOut(10, TimeUnit.SECONDS); - String baseUrl = jettys.get(0).getBaseUrl().toString(); - verifySecurityStatus( - ((CloudLegacySolrClient) cloudClient).getHttpClient(), - baseUrl + "/admin/authorization", - "authorization/class", - MockAuthorizationPlugin.class.getName(), - 20); - log.info("Starting test"); - ModifiableSolrParams params = new ModifiableSolrParams(); - params.add("q", "*:*"); - // This should work fine. - cloudClient.query(params); - MockAuthorizationPlugin.protectedResources.add("/select"); + waitForThingsToLevelOut(10, TimeUnit.SECONDS); + String baseUrl = jettys.get(0).getBaseUrl().toString(); + verifySecurityStatus( + ((CloudLegacySolrClient) cloudClient).getHttpClient(), + baseUrl + "/admin/authorization", + "authorization/class", + s -> MockAuthorizationPlugin.class.getName().equals(s), + 20); - // This user is disallowed in the mock. The request should return a 403. - params.add("uname", "user1"); - expectThrows(Exception.class, () -> cloudClient.query(params)); - log.info("Ending test"); - } finally { - MockAuthorizationPlugin.denyUsers.clear(); - MockAuthorizationPlugin.protectedResources.clear(); - } + // This should work fine. + ModifiableSolrParams params = new ModifiableSolrParams(); + params.add("q", "*:*"); + cloudClient.query(params); + + // This user is disallowed in the mock. The request should return a 403. + MockAuthorizationPlugin.protectedResources.add("/select"); + params.add("uname", "user1"); + expectThrows(Exception.class, () -> cloudClient.query(params)); } @Override public void distribTearDown() throws Exception { - super.distribTearDown(); + MockAuthorizationPlugin.protectedResources.clear(); MockAuthorizationPlugin.denyUsers.clear(); + super.distribTearDown(); } public static void verifySecurityStatus( - HttpClient cl, String url, String objPath, Object expected, int count) throws Exception { - boolean success = false; + HttpClient cl, String url, String objPath, Predicate expected, int count) + throws Exception { String s = null; List hierarchy = StrUtils.splitSmart(objPath, '/'); for (int i = 0; i < count; i++) { @@ -110,19 +101,11 @@ public static void verifySecurityStatus( Map m = (Map) Utils.fromJSONString(s); Object actual = Utils.getObjectByPath(m, true, hierarchy); - if (expected instanceof Predicate) { - @SuppressWarnings("unchecked") - Predicate predicate = (Predicate) expected; - if (predicate.test(actual)) { - success = true; - break; - } - } else if (Objects.equals(String.valueOf(actual), expected)) { - success = true; - break; + if (expected.test(actual)) { + return; } Thread.sleep(50); } - assertTrue("No match for " + objPath + " = " + expected + ", full response = " + s, success); + fail("No match for " + objPath + " = " + expected + ", full response = " + s); } } diff --git a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java index 6261a6d89a5..d2843a7ffe8 100644 --- a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java +++ b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java @@ -19,7 +19,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.LuceneTestCase.SuppressTempFileChecks; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.SolrTestCaseJ4; @@ -41,7 +40,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow @SuppressTempFileChecks( bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?") public class SpellCheckCollatorTest extends SolrTestCaseJ4 { diff --git a/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java b/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java index 589c67823d1..141c45651b8 100644 --- a/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java +++ b/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java @@ -24,7 +24,7 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import org.apache.lucene.tests.util.LuceneTestCase.Nightly; import org.apache.lucene.util.Constants; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.core.SolrCore; @@ -33,6 +33,7 @@ import org.apache.solr.util.TestHarness; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,7 +51,7 @@ * to affect the expectation of how slow B->C will be * */ -@Slow +@Nightly // we could drop this by testing only one NONE/SOFT/HARD each time based on seed public class SoftAutoCommitTest extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -82,11 +83,7 @@ public void createMonitor() throws Exception { monitor.searcher.poll(5000, MILLISECONDS); } - @Override - public void setUp() throws Exception { - super.setUp(); - } - + @Test public void testSoftAndHardCommitMaxDocs() throws Exception { // NOTE WHEN READING THIS TEST... @@ -164,14 +161,17 @@ public void testSoftAndHardCommitMaxDocs() throws Exception { monitor.clear(); } + @Test public void testSoftAndHardCommitMaxTimeMixedAdds() throws Exception { doTestSoftAndHardCommitMaxTimeMixedAdds(CommitWithinType.NONE); } + @Test public void testSoftCommitWithinAndHardCommitMaxTimeMixedAdds() throws Exception { doTestSoftAndHardCommitMaxTimeMixedAdds(CommitWithinType.SOFT); } + @Test public void testHardCommitWithinAndSoftCommitMaxTimeMixedAdds() throws Exception { doTestSoftAndHardCommitMaxTimeMixedAdds(CommitWithinType.HARD); } @@ -310,14 +310,17 @@ private void doTestSoftAndHardCommitMaxTimeMixedAdds(final CommitWithinType comm monitor.searcher.clear(); } + @Test public void testSoftAndHardCommitMaxTimeDelete() throws Exception { doTestSoftAndHardCommitMaxTimeDelete(CommitWithinType.NONE); } + @Test public void testSoftCommitWithinAndHardCommitMaxTimeDelete() throws Exception { doTestSoftAndHardCommitMaxTimeDelete(CommitWithinType.SOFT); } + @Test public void testHardCommitWithinAndSoftCommitMaxTimeDelete() throws Exception { doTestSoftAndHardCommitMaxTimeDelete(CommitWithinType.HARD); } @@ -429,14 +432,17 @@ private void doTestSoftAndHardCommitMaxTimeDelete(final CommitWithinType commitW monitor.searcher.clear(); } + @Test public void testSoftAndHardCommitMaxTimeRapidAdds() throws Exception { doTestSoftAndHardCommitMaxTimeRapidAdds(CommitWithinType.NONE); } + @Test public void testSoftCommitWithinAndHardCommitMaxTimeRapidAdds() throws Exception { doTestSoftAndHardCommitMaxTimeRapidAdds(CommitWithinType.SOFT); } + @Test public void testHardCommitWithinAndSoftCommitMaxTimeRapidAdds() throws Exception { doTestSoftAndHardCommitMaxTimeRapidAdds(CommitWithinType.HARD); } diff --git a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java index 8b80454b028..bfc47dd83cf 100644 --- a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java +++ b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java @@ -34,7 +34,6 @@ import java.util.concurrent.TimeoutException; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.NoMergePolicy; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrServerException; @@ -72,7 +71,6 @@ import org.slf4j.LoggerFactory; /** Tests the in-place updates (docValues updates) for a one shard, three replica cluster. */ -@Slow public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private final boolean onlyLeaderIndexes = random().nextBoolean(); diff --git a/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.java index 45d181040c8..ebf912b27b0 100644 --- a/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.java +++ b/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.java @@ -89,7 +89,6 @@ public static void cleanUpAfterClass() { } @Test - @Slow public void testNonEnglish() throws Exception { // test to document the expected behavior with non-english text for categories // the present expectation is that non-latin text and many accented latin characters @@ -174,7 +173,6 @@ private void assertColHasDocCount(String collectionChinese, int expected) assertEquals(expected, aliasNumFound); } - @Slow @Test public void test() throws Exception { String configName = getSaferTestName(); @@ -245,7 +243,6 @@ private String noDollar(String ship) { return ship.replaceAll("\\$", "_"); } - @Slow @Test public void testMustMatch() throws Exception { String configName = getSaferTestName(); @@ -299,7 +296,6 @@ public void testMustMatch() throws Exception { assertInvariants(colVogon, colHoG); } - @Slow @Test public void testInvalidMustMatch() throws Exception { String configName = getSaferTestName(); @@ -339,7 +335,6 @@ public void testInvalidMustMatch() throws Exception { e.getMessage().contains("router.mustMatch must be a valid regular expression")); } - @Slow @Test public void testMaxCardinality() throws Exception { String configName = getSaferTestName(); @@ -397,7 +392,6 @@ public void testMaxCardinality() throws Exception { * * @throws Exception when it blows up unexpectedly :) */ - @Slow @Test @LogLevel("org.apache.solr.update.processor.TrackingUpdateProcessorFactory=DEBUG") public void testSliceRouting() throws Exception { diff --git a/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java index f68d74b87ed..2725d3d1e11 100644 --- a/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java +++ b/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java @@ -106,7 +106,6 @@ public void doAfter() throws Exception { shutdownCluster(); } - @Slow @Test @LogLevel("org.apache.solr.update.processor.TimeRoutedAlias=DEBUG;org.apache.solr.cloud=DEBUG") public void test() throws Exception { @@ -257,7 +256,6 @@ public void test() throws Exception { * * @throws Exception when it blows up unexpectedly :) */ - @Slow @Test @LogLevel("org.apache.solr.update.processor.TrackingUpdateProcessorFactory=DEBUG") public void testSliceRouting() throws Exception { @@ -317,7 +315,6 @@ public void testSliceRouting() throws Exception { } @Test - @Slow public void testPreemptiveCreation() throws Exception { String configName = getSaferTestName(); createConfigSet(configName); diff --git a/solr/core/src/test/org/apache/solr/util/MultipleManagedSchemasTest.java b/solr/core/src/test/org/apache/solr/util/MultipleManagedSchemasTest.java index 37a2e71da6a..706cf33afba 100644 --- a/solr/core/src/test/org/apache/solr/util/MultipleManagedSchemasTest.java +++ b/solr/core/src/test/org/apache/solr/util/MultipleManagedSchemasTest.java @@ -21,27 +21,17 @@ import org.apache.solr.client.solrj.request.ConfigSetAdminRequest; import org.apache.solr.cloud.SolrCloudTestCase; import org.apache.solr.common.cloud.ZkMaintenanceUtils; -import org.junit.After; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; public class MultipleManagedSchemasTest extends SolrCloudTestCase { - @Before - public void setUp() throws Exception { - super.setUp(); + @BeforeClass + public static void setUpCluster() throws Exception { System.setProperty("managed.schema.mutable", "false"); configureCluster(1).configure(); } - @After - public void tearDown() throws Exception { - if (cluster != null) { - cluster.shutdown(); - } - super.tearDown(); - } - @Test public void testSameCollectionNameWithMultipleSchemas() throws Exception { CloudSolrClient client = cluster.getSolrClient(); diff --git a/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java b/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java index 246ef086a93..2aa20cfb6f2 100644 --- a/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java +++ b/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java @@ -54,7 +54,6 @@ import org.slf4j.LoggerFactory; /** Tests the SolrCLI.RunExampleTool implementation that supports bin/solr -e [example] */ -@LuceneTestCase.Slow @SolrTestCaseJ4.SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") public class TestSolrCLIRunExample extends SolrTestCaseJ4 { @@ -312,11 +311,13 @@ public void tearDown() throws Exception { } @Test + @LuceneTestCase.Nightly public void testTechproductsExample() throws Exception { testExample("techproducts"); } @Test + @LuceneTestCase.Nightly public void testSchemalessExample() throws Exception { testExample("schemaless"); } diff --git a/solr/core/src/test/org/apache/solr/util/hll/HLLSerializationTest.java b/solr/core/src/test/org/apache/solr/util/hll/HLLSerializationTest.java index e96ff666b60..0f0de77aa97 100644 --- a/solr/core/src/test/org/apache/solr/util/hll/HLLSerializationTest.java +++ b/solr/core/src/test/org/apache/solr/util/hll/HLLSerializationTest.java @@ -42,7 +42,6 @@ public class HLLSerializationTest extends SolrTestCase { * parameters. */ @Test - @Slow @Nightly public void serializationSmokeTest() throws Exception { final Random random = new Random(randomLong()); @@ -68,7 +67,6 @@ public void serializationSmokeTest() throws Exception { * @see #manyValuesHLLSerializationTest */ @Test - @Slow @Monster("needs roughly -Dtests.heapsize=8g because of the (multiple) massive data structs") public void monsterHLLSerializationTest() throws Exception { final Random random = new Random(randomLong()); @@ -95,7 +93,6 @@ public void monsterHLLSerializationTest() throws Exception { * @see #monsterHLLSerializationTest */ @Test - @Slow @Monster("may require as much as -Dtests.heapsize=4g depending on random values picked") public void manyValuesHLLSerializationTest() { @@ -140,7 +137,6 @@ public void manyValuesHLLSerializationTest() { * @see #monsterHLLSerializationTest */ @Test - @Slow @Monster("can require as much as -Dtests.heapsize=4g because of the massive data structs") public void manyValuesMonsterHLLSerializationTest() { diff --git a/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithDelegationTokens.java b/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithDelegationTokens.java index 13dfe1ae986..61b47fca84e 100644 --- a/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithDelegationTokens.java +++ b/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithDelegationTokens.java @@ -25,7 +25,6 @@ import java.util.Set; import org.apache.hadoop.util.Time; import org.apache.http.HttpStatus; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrRequest; @@ -54,7 +53,6 @@ import org.slf4j.LoggerFactory; /** Test the delegation token support in the {@link KerberosPlugin}. */ -@LuceneTestCase.Slow public class TestSolrCloudWithDelegationTokens extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final int NUM_SERVERS = 2; diff --git a/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithKerberosAlt.java b/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithKerberosAlt.java index a8601a5e2cf..c9a5bb42df8 100644 --- a/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithKerberosAlt.java +++ b/solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithKerberosAlt.java @@ -19,7 +19,6 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; import java.lang.invoke.MethodHandles; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.client.solrj.SolrQuery; @@ -42,7 +41,6 @@ QuickPatchThreadsFilter.class, BadZookeeperThreadsFilter.class // Zookeeper login leaks TGT renewal threads }) -@LuceneTestCase.Slow @ThreadLeakLingering(linger = 10000) // minikdc has some lingering threads public class TestSolrCloudWithKerberosAlt extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsBasicDistributedZk2Test.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsBasicDistributedZk2Test.java index 3b4509e4f1b..921569ee651 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsBasicDistributedZk2Test.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsBasicDistributedZk2Test.java @@ -21,7 +21,6 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; import java.io.IOException; import org.apache.hadoop.hdfs.MiniDFSCluster; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.cloud.AbstractBasicDistributedZk2TestBase; @@ -29,7 +28,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsBasicDistributedZkTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsBasicDistributedZkTest.java index 095dc50d521..6b4d8daafa8 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsBasicDistributedZkTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsBasicDistributedZkTest.java @@ -21,7 +21,6 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; import java.io.IOException; import org.apache.hadoop.hdfs.MiniDFSCluster; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.cloud.AbstractBasicDistributedZkTestBase; @@ -30,7 +29,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsChaosMonkeyNothingIsSafeTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsChaosMonkeyNothingIsSafeTest.java index 4bba2c90c19..0d9744f0034 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsChaosMonkeyNothingIsSafeTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsChaosMonkeyNothingIsSafeTest.java @@ -21,7 +21,6 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; import java.io.IOException; import org.apache.hadoop.hdfs.MiniDFSCluster; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.cloud.AbstractChaosMonkeyNothingIsSafeTestBase; @@ -30,7 +29,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsChaosMonkeySafeLeaderTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsChaosMonkeySafeLeaderTest.java index 5b02ea1e5e1..dbeebf95ffe 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsChaosMonkeySafeLeaderTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsChaosMonkeySafeLeaderTest.java @@ -21,7 +21,6 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; import java.io.IOException; import org.apache.hadoop.hdfs.MiniDFSCluster; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.cloud.AbstractChaosMonkeySafeLeaderTestBase; @@ -30,7 +29,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsNameNodeFailoverTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsNameNodeFailoverTest.java index a8959899d49..dd7721d7ed4 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsNameNodeFailoverTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsNameNodeFailoverTest.java @@ -20,7 +20,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; import java.io.IOException; import org.apache.hadoop.hdfs.MiniDFSCluster; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; +import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.cloud.AbstractBasicDistributedZkTestBase; @@ -29,7 +29,7 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow +@LuceneTestCase.Nightly @ThreadLeakFilters( defaultFilters = true, filters = { diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsRecoveryZkTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsRecoveryZkTest.java index e192446f5a0..456bfb49491 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsRecoveryZkTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsRecoveryZkTest.java @@ -21,7 +21,6 @@ import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.tests.util.LuceneTestCase.Nightly; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.cloud.AbstractRecoveryZkTestBase; @@ -29,7 +28,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; -@Slow @Nightly @LuceneTestCase.AwaitsFix(bugUrl = "SOLR-15405") @ThreadLeakFilters( diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsRestartWhileUpdatingTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsRestartWhileUpdatingTest.java index 5b091e54422..32a973dd841 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsRestartWhileUpdatingTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsRestartWhileUpdatingTest.java @@ -20,7 +20,6 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; import org.apache.hadoop.hdfs.MiniDFSCluster; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.cloud.AbstractRestartWhileUpdatingTestBase; @@ -29,7 +28,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsSyncSliceTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsSyncSliceTest.java index 38cdeed6f47..b2dcd1d95c0 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsSyncSliceTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsSyncSliceTest.java @@ -21,7 +21,6 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; import java.io.IOException; import org.apache.hadoop.hdfs.MiniDFSCluster; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.cloud.AbstractSyncSliceTestBase; @@ -29,7 +28,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsTlogReplayBufferedWhileIndexingTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsTlogReplayBufferedWhileIndexingTest.java index 2856d9eae04..8bd94fcd708 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsTlogReplayBufferedWhileIndexingTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsTlogReplayBufferedWhileIndexingTest.java @@ -20,7 +20,6 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; import org.apache.hadoop.hdfs.MiniDFSCluster; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.cloud.AbstractTlogReplayBufferedWhileIndexingTestBase; @@ -28,7 +27,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsUnloadDistributedZkTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsUnloadDistributedZkTest.java index a980fbd65b8..6cea5b61c0b 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsUnloadDistributedZkTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsUnloadDistributedZkTest.java @@ -20,7 +20,6 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; import org.apache.hadoop.hdfs.MiniDFSCluster; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.cloud.AbstractUnloadDistributedZkTestBase; @@ -28,7 +27,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsWriteToMultipleCollectionsTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsWriteToMultipleCollectionsTest.java index c4ea95045cd..6eab88e1563 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsWriteToMultipleCollectionsTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsWriteToMultipleCollectionsTest.java @@ -30,7 +30,6 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.NRTCachingDirectory; import org.apache.lucene.tests.util.LuceneTestCase.Nightly; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.lucene.util.IOUtils; import org.apache.solr.SolrIgnoredThreadsFilter; @@ -53,7 +52,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/MoveReplicaHdfsTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/MoveReplicaHdfsTest.java index b125746f85c..3d504762802 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/MoveReplicaHdfsTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/MoveReplicaHdfsTest.java @@ -22,7 +22,6 @@ import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.tests.util.LuceneTestCase.AwaitsFix; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.lucene.tests.util.TimeUnits; import org.apache.solr.SolrIgnoredThreadsFilter; @@ -32,7 +31,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/SharedFileSystemAutoReplicaFailoverTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/SharedFileSystemAutoReplicaFailoverTest.java index d430e2cde11..d73414b3cf3 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/SharedFileSystemAutoReplicaFailoverTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/SharedFileSystemAutoReplicaFailoverTest.java @@ -35,7 +35,6 @@ import java.util.stream.Collectors; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.lucene.tests.util.LuceneTestCase; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; @@ -73,7 +72,6 @@ import org.slf4j.LoggerFactory; @Nightly -@Slow @SuppressSSL @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/StressHdfsTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/StressHdfsTest.java index 065f183c2a0..7449614ff4a 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/StressHdfsTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/StressHdfsTest.java @@ -32,7 +32,6 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.solr.SolrIgnoredThreadsFilter; import org.apache.solr.client.solrj.SolrClient; @@ -55,7 +54,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, diff --git a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/api/collections/HdfsCollectionsApiDistributedZkTest.java b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/api/collections/HdfsCollectionsApiDistributedZkTest.java index c3129c806d7..2015e4934e9 100644 --- a/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/api/collections/HdfsCollectionsApiDistributedZkTest.java +++ b/solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/api/collections/HdfsCollectionsApiDistributedZkTest.java @@ -20,7 +20,6 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite; import org.apache.hadoop.hdfs.MiniDFSCluster; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.QuickPatchThreadsFilter; import org.apache.lucene.tests.util.TimeUnits; import org.apache.solr.SolrIgnoredThreadsFilter; @@ -30,7 +29,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; -@Slow @Nightly @ThreadLeakFilters( defaultFilters = true, @@ -47,6 +45,12 @@ public class HdfsCollectionsApiDistributedZkTest @BeforeClass public static void setupClass() throws Exception { dfsCluster = HdfsTestUtil.setupClass(createTempDir().toFile().getAbsolutePath()); + + configureCluster(4) + .addConfig("conf", configset("cloud-hdfs")) + .addConfig("conf2", configset("cloud-hdfs")) + .withSolrXml(TEST_PATH().resolve("solr.xml")) + .configure(); } @AfterClass @@ -57,9 +61,4 @@ public static void teardownClass() throws Exception { dfsCluster = null; } } - - @Override - protected String getConfigSet() { - return "cloud-hdfs"; - } } diff --git a/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java b/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java index 0f2a3fb2c20..e714f8da8b2 100644 --- a/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java +++ b/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java @@ -28,7 +28,6 @@ import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.apache.lucene.tests.util.LuceneTestCase; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.io.Tuple; import org.apache.solr.client.solrj.io.stream.ExceptionStream; @@ -45,7 +44,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow @SolrTestCaseJ4.SuppressSSL @LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Lucene45"}) public class TestSQLHandler extends SolrCloudTestCase { diff --git a/solr/prometheus-exporter/src/test/org/apache/solr/prometheus/exporter/SolrExporterIntegrationTest.java b/solr/prometheus-exporter/src/test/org/apache/solr/prometheus/exporter/SolrExporterIntegrationTest.java index 364e4b9aaae..f4965b54ef9 100644 --- a/solr/prometheus-exporter/src/test/org/apache/solr/prometheus/exporter/SolrExporterIntegrationTest.java +++ b/solr/prometheus-exporter/src/test/org/apache/solr/prometheus/exporter/SolrExporterIntegrationTest.java @@ -18,12 +18,9 @@ import java.util.Map; import java.util.stream.Collectors; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.junit.Before; import org.junit.Test; -// @org.apache.lucene.util.LuceneTestCase.AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-13786") -@Slow public class SolrExporterIntegrationTest extends SolrExporterTestBase { @Override diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java index 21380c4a0ac..7f142474faf 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java @@ -231,6 +231,7 @@ public RequestStatusState processAndWait(SolrClient client, long timeoutSeconds) */ public RequestStatusState processAndWait(String asyncId, SolrClient client, long timeoutSeconds) throws IOException, SolrServerException, InterruptedException { + // This is kind of slow, see SOLR-16313 processAsync(asyncId, client); return propagateBasicAuthCreds(requestStatus(asyncId)).waitFor(client, timeoutSeconds); } @@ -1801,6 +1802,7 @@ public RequestStatusState waitFor(SolrClient client, long timeoutSeconds) propagateBasicAuthCreds(deleteAsyncId(requestId)).process(client); return state; } + // This is kind of slow, see SOLR-16313 TimeUnit.SECONDS.sleep(1); } return state; diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttp2SolrClient.java b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttp2SolrClient.java index b9ed6f27336..2885f49e0de 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttp2SolrClient.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttp2SolrClient.java @@ -28,7 +28,6 @@ import java.util.concurrent.TimeUnit; import junit.framework.Assert; import org.apache.commons.io.FileUtils; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.util.IOUtils; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.embedded.JettyConfig; @@ -51,7 +50,6 @@ * * @since solr 1.4 */ -@Slow public class TestLBHttp2SolrClient extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java index 07abc947cdb..3f2b378193f 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java @@ -29,7 +29,6 @@ import junit.framework.Assert; import org.apache.commons.io.FileUtils; import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.util.IOUtils; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.embedded.JettyConfig; @@ -52,7 +51,6 @@ * * @since solr 1.4 */ -@Slow public class TestLBHttpSolrClient extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingBinaryHttp2Test.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingBinaryHttp2Test.java index aada4bb2a0a..70dbc358f36 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingBinaryHttp2Test.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingBinaryHttp2Test.java @@ -19,7 +19,6 @@ import java.util.ArrayList; import java.util.List; -import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; @@ -33,7 +32,6 @@ import org.apache.solr.common.SolrInputDocument; import org.junit.Test; -@LuceneTestCase.Slow @SolrTestCaseJ4.SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") public class SolrExampleStreamingBinaryHttp2Test extends SolrExampleStreamingHttp2Test { diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingBinaryTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingBinaryTest.java index 5da299ae4e7..aae29ac8533 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingBinaryTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingBinaryTest.java @@ -18,7 +18,6 @@ import java.util.ArrayList; import java.util.List; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; @@ -31,7 +30,6 @@ import org.apache.solr.common.SolrInputDocument; import org.junit.Test; -@Slow @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776") public class SolrExampleStreamingBinaryTest extends SolrExampleStreamingTest { diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java index 50a2f761e37..75ad41b9018 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java @@ -20,7 +20,6 @@ import java.util.Arrays; import java.util.EnumSet; import java.util.List; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrExampleTests; import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient; @@ -33,7 +32,6 @@ /** * @since solr 1.3 */ -@Slow public class SolrExampleStreamingTest extends SolrExampleTests { @BeforeClass diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java index 1b27860fded..d6161adc132 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java @@ -38,7 +38,6 @@ import java.util.Set; import java.util.concurrent.TimeoutException; import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; @@ -72,22 +71,17 @@ import org.apache.solr.handler.admin.CollectionsHandler; import org.apache.solr.handler.admin.ConfigSetsHandler; import org.apache.solr.handler.admin.CoreAdminHandler; -import org.junit.After; import org.junit.AfterClass; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** This test would be faster if we simulated the zk state instead. */ -@Slow public class CloudHttp2SolrClientTest extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final String COLLECTION = "collection1"; - private static final String COLLECTION2 = "2nd_collection"; - private static final String id = "id"; private static final int TIMEOUT = 30; @@ -96,8 +90,8 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase { private static CloudHttp2SolrClient httpBasedCloudSolrClient = null; private static CloudHttp2SolrClient zkBasedCloudSolrClient = null; - @Before - public void setupCluster() throws Exception { + @BeforeClass + public static void setupCluster() throws Exception { System.setProperty("metricsEnabled", "true"); configureCluster(NODE_COUNT) .addConfig( @@ -119,8 +113,8 @@ public void setupCluster() throws Exception { .build(); } - @After - public void tearDown() throws Exception { + @AfterClass + public static void tearDownAfterClass() throws Exception { if (httpBasedCloudSolrClient != null) { try { httpBasedCloudSolrClient.close(); @@ -137,11 +131,6 @@ public void tearDown() throws Exception { } shutdownCluster(); - super.tearDown(); - } - - @AfterClass - public static void cleanUpAfterClass() throws Exception { httpBasedCloudSolrClient = null; zkBasedCloudSolrClient = null; } @@ -154,6 +143,7 @@ private CloudHttp2SolrClient getRandomClient() { @Test public void testParallelUpdateQTime() throws Exception { + String COLLECTION = getSaferTestName(); CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1) .process(cluster.getSolrClient()); cluster.waitForActiveCollection(COLLECTION, 2, 2); @@ -198,6 +188,9 @@ public void testOverwriteOption() throws Exception { @Test public void testAliasHandling() throws Exception { + String COLLECTION = getSaferTestName(); + String COLLECTION2 = "2nd_collection"; + CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1) .process(cluster.getSolrClient()); cluster.waitForActiveCollection(COLLECTION, 2, 2); @@ -288,7 +281,7 @@ public void testRouting() throws Exception { try (HttpSolrClient solrClient = getHttpSolrClient(url)) { QueryResponse queryResponse = queryRequest.process(solrClient); SolrDocumentList docList = queryResponse.getResults(); - assertTrue(docList.getNumFound() == 1); + assertEquals(1, docList.getNumFound()); } } @@ -334,7 +327,7 @@ public void testRouting() throws Exception { try (HttpSolrClient solrClient = getHttpSolrClient(url)) { QueryResponse queryResponse = queryRequest.process(solrClient); SolrDocumentList docList = queryResponse.getResults(); - assertTrue(docList.getNumFound() == 1); + assertEquals(1, docList.getNumFound()); } } } @@ -746,6 +739,7 @@ public void checkCollectionParameters() throws Exception { @Test public void stateVersionParamTest() throws Exception { + String COLLECTION = getSaferTestName(); CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1) .process(cluster.getSolrClient()); cluster.waitForActiveCollection(COLLECTION, 2, 2); @@ -913,13 +907,13 @@ public void testVersionsAreReturned() throws Exception { @Test public void testInitializationWithSolrUrls() throws Exception { + String COLLECTION = getSaferTestName(); CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1) .process(cluster.getSolrClient()); cluster.waitForActiveCollection(COLLECTION, 2, 2); CloudHttp2SolrClient client = httpBasedCloudSolrClient; SolrInputDocument doc = new SolrInputDocument("id", "1", "title_s", "my doc"); - client.add(COLLECTION, doc); - client.commit(COLLECTION); + new UpdateRequest().add(doc).commit(client, COLLECTION); assertEquals(1, client.query(COLLECTION, params("q", "*:*")).getResults().getNumFound()); } @@ -1120,7 +1114,7 @@ private void queryWithPreferReplicaTypes( assertNotNull( ShardParams.SHARDS_INFO + " did not return 'shardAddress' parameter", shardAddress); assertTrue(replicaTypeMap.containsKey(shardAddress)); - assertTrue(preferredTypes.indexOf(replicaTypeMap.get(shardAddress)) == 0); + assertEquals(0, preferredTypes.indexOf(replicaTypeMap.get(shardAddress))); shardAddresses.add(shardAddress); } assertTrue("No responses", shardAddresses.size() > 0); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java index f01c5346cd4..8813480e1bf 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java @@ -38,7 +38,6 @@ import java.util.Set; import java.util.concurrent.TimeoutException; import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; @@ -78,9 +77,8 @@ import org.apache.solr.util.LogLevel; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; -import org.junit.After; import org.junit.AfterClass; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -88,16 +86,12 @@ import org.slf4j.LoggerFactory; /** This test would be faster if we simulated the zk state instead. */ -@Slow @LogLevel( "org.apache.solr.cloud.Overseer=INFO;org.apache.solr.common.cloud=INFO;org.apache.solr.cloud.api.collections=INFO;org.apache.solr.cloud.overseer=INFO") public class CloudSolrClientTest extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final String COLLECTION = "collection1"; - private static final String COLLECTION2 = "2nd_collection"; - private static final String id = "id"; private static final int TIMEOUT = 30; @@ -105,8 +99,8 @@ public class CloudSolrClientTest extends SolrCloudTestCase { private static CloudSolrClient httpBasedCloudSolrClient = null; - @Before - public void setupCluster() throws Exception { + @BeforeClass + public static void setupCluster() throws Exception { System.setProperty("metricsEnabled", "true"); configureCluster(NODE_COUNT) .addConfig( @@ -124,8 +118,8 @@ public void setupCluster() throws Exception { httpBasedCloudSolrClient = new CloudLegacySolrClient.Builder(solrUrls).build(); } - @After - public void tearDown() throws Exception { + @AfterClass + public static void tearDownAfterClass() throws Exception { if (httpBasedCloudSolrClient != null) { try { httpBasedCloudSolrClient.close(); @@ -133,14 +127,9 @@ public void tearDown() throws Exception { throw new RuntimeException(e); } } + httpBasedCloudSolrClient = null; shutdownCluster(); - super.tearDown(); - } - - @AfterClass - public static void cleanUpAfterClass() throws Exception { - httpBasedCloudSolrClient = null; } /** Randomly return the cluster's ZK based CSC, or HttpClusterProvider based CSC. */ @@ -150,6 +139,8 @@ private CloudSolrClient getRandomClient() { @Test public void testParallelUpdateQTime() throws Exception { + String COLLECTION = getSaferTestName(); + CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1) .setPerReplicaState(USE_PER_REPLICA_STATE) .process(cluster.getSolrClient()); @@ -196,6 +187,9 @@ public void testOverwriteOption() throws Exception { @Test public void testAliasHandling() throws Exception { + String COLLECTION = getSaferTestName(); + String COLLECTION2 = "2nd_collection"; + CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1) .setPerReplicaState(USE_PER_REPLICA_STATE) .process(cluster.getSolrClient()); @@ -289,7 +283,7 @@ public void testRouting() throws Exception { try (HttpSolrClient solrClient = getHttpSolrClient(url)) { QueryResponse queryResponse = queryRequest.process(solrClient); SolrDocumentList docList = queryResponse.getResults(); - assertTrue(docList.getNumFound() == 1); + assertEquals(1, docList.getNumFound()); } } @@ -335,7 +329,7 @@ public void testRouting() throws Exception { try (HttpSolrClient solrClient = getHttpSolrClient(url)) { QueryResponse queryResponse = queryRequest.process(solrClient); SolrDocumentList docList = queryResponse.getResults(); - assertTrue(docList.getNumFound() == 1); + assertEquals(1, docList.getNumFound()); } } } @@ -442,8 +436,7 @@ public void queryWithLocalShardsPreferenceRulesTest() throws Exception { int liveNodes = cluster.getJettySolrRunners().size(); - // For this case every shard should have - // all its cores on the same node. + // For this case every shard should have all its cores on the same node. // Hence the below configuration for our collection CollectionAdminRequest.createCollection(collectionName, "conf", liveNodes, liveNodes) .setPerReplicaState(USE_PER_REPLICA_STATE) @@ -632,14 +625,16 @@ private Long getNumRequests( @Test public void testNonRetryableRequests() throws Exception { + String collection = getSaferTestName(); + try (CloudSolrClient client = getCloudSolrClient(cluster.getZkServer().getZkAddress())) { // important to have one replica on each node RequestStatusState state = - CollectionAdminRequest.createCollection("foo", "conf", 1, NODE_COUNT) + CollectionAdminRequest.createCollection(collection, "conf", 1, NODE_COUNT) .processAndWait(client, 60); if (state == RequestStatusState.COMPLETED) { - cluster.waitForActiveCollection("foo", 1, NODE_COUNT); - client.setDefaultCollection("foo"); + cluster.waitForActiveCollection(collection, 1, NODE_COUNT); + client.setDefaultCollection(collection); Map adminPathToMbean = new HashMap<>(CommonParams.ADMIN_PATHS.size()); adminPathToMbean.put( @@ -655,7 +650,7 @@ public void testNonRetryableRequests() throws Exception { Long numRequests = getNumRequests( runner.getBaseUrl().toString(), - "foo", + collection, "ADMIN", adminPathToMbean.get(adminPath), adminPath, @@ -682,7 +677,7 @@ public void testNonRetryableRequests() throws Exception { Long numRequests = getNumRequests( runner.getBaseUrl().toString(), - "foo", + collection, "ADMIN", adminPathToMbean.get(adminPath), adminPath, @@ -750,6 +745,8 @@ public void checkCollectionParameters() throws Exception { @Test public void stateVersionParamTest() throws Exception { + String COLLECTION = getSaferTestName(); + CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1) .process(cluster.getSolrClient()); cluster.waitForActiveCollection(COLLECTION, 2, 2); @@ -873,18 +870,19 @@ public void customHttpClientTest() throws IOException { @Test public void testVersionsAreReturned() throws Exception { - CollectionAdminRequest.createCollection("versions_collection", "conf", 2, 1) + String collection = getSaferTestName(); + + CollectionAdminRequest.createCollection(collection, "conf", 2, 1) .setPerReplicaState(USE_PER_REPLICA_STATE) .process(cluster.getSolrClient()); - cluster.waitForActiveCollection("versions_collection", 2, 2); + cluster.waitForActiveCollection(collection, 2, 2); // assert that "adds" are returned UpdateRequest updateRequest = new UpdateRequest().add("id", "1", "a_t", "hello1").add("id", "2", "a_t", "hello2"); updateRequest.setParam(UpdateParams.VERSIONS, Boolean.TRUE.toString()); - NamedList response = - updateRequest.commit(getRandomClient(), "versions_collection").getResponse(); + NamedList response = updateRequest.commit(getRandomClient(), collection).getResponse(); Object addsObject = response.get("adds"); assertNotNull("There must be a adds parameter", addsObject); @@ -903,7 +901,7 @@ public void testVersionsAreReturned() throws Exception { assertTrue("Version for id 2 must be a long", object instanceof Long); versions.put("2", (Long) object); - QueryResponse resp = getRandomClient().query("versions_collection", new SolrQuery("*:*")); + QueryResponse resp = getRandomClient().query(collection, new SolrQuery("*:*")); assertEquals( "There should be one document because overwrite=true", 2, resp.getResults().getNumFound()); @@ -916,7 +914,7 @@ public void testVersionsAreReturned() throws Exception { // assert that "deletes" are returned UpdateRequest deleteRequest = new UpdateRequest().deleteById("1"); deleteRequest.setParam(UpdateParams.VERSIONS, Boolean.TRUE.toString()); - response = deleteRequest.commit(getRandomClient(), "versions_collection").getResponse(); + response = deleteRequest.commit(getRandomClient(), collection).getResponse(); Object deletesObject = response.get("deletes"); assertNotNull("There must be a deletes parameter", deletesObject); NamedList deletes = (NamedList) deletesObject; @@ -925,6 +923,8 @@ public void testVersionsAreReturned() throws Exception { @Test public void testInitializationWithSolrUrls() throws Exception { + String COLLECTION = getSaferTestName(); + CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1) .setPerReplicaState(USE_PER_REPLICA_STATE) .process(cluster.getSolrClient()); @@ -1125,7 +1125,7 @@ private void queryWithPreferReplicaTypes( assertNotNull( ShardParams.SHARDS_INFO + " did not return 'shardAddress' parameter", shardAddress); assertTrue(replicaTypeMap.containsKey(shardAddress)); - assertTrue(preferredTypes.indexOf(replicaTypeMap.get(shardAddress)) == 0); + assertEquals(0, preferredTypes.indexOf(replicaTypeMap.get(shardAddress))); shardAddresses.add(shardAddress); } assertTrue("No responses", shardAddresses.size() > 0); @@ -1149,10 +1149,14 @@ public void testPing() throws Exception { } public void testPerReplicaStateCollection() throws Exception { - CollectionAdminRequest.createCollection("versions_collection", "conf", 2, 1) + String collection = getSaferTestName(); + + CollectionAdminRequest.createCollection(collection, "conf", 2, 1) .process(cluster.getSolrClient()); String testCollection = "perReplicaState_test"; + String collectionPath = ZkStateReader.getCollectionPath(testCollection); + int liveNodes = cluster.getJettySolrRunners().size(); CollectionAdminRequest.createCollection(testCollection, "conf", 2, 2) .setPerReplicaState(Boolean.TRUE) @@ -1161,34 +1165,41 @@ public void testPerReplicaStateCollection() throws Exception { final SolrClient clientUnderTest = getRandomClient(); final SolrPingResponse response = clientUnderTest.ping(testCollection); assertEquals("This should be OK", 0, response.getStatus()); + DocCollection c = cluster.getZkStateReader().getCollection(testCollection); c.forEachReplica((s, replica) -> assertNotNull(replica.getReplicaState())); - PerReplicaStates prs = - PerReplicaStates.fetch( - ZkStateReader.getCollectionPath(testCollection), cluster.getZkClient(), null); - assertEquals(4, prs.states.size()); - JettySolrRunner jsr = cluster.startJettySolrRunner(); - // Now let's do an add replica - CollectionAdminRequest.addReplicaToShard(testCollection, "shard1") - .process(cluster.getSolrClient()); - prs = - PerReplicaStates.fetch( - ZkStateReader.getCollectionPath(testCollection), cluster.getZkClient(), null); - assertEquals(5, prs.states.size()); - - testCollection = "perReplicaState_testv2"; - new V2Request.Builder("/collections") - .withMethod(POST) - .withPayload( - "{create: {name: perReplicaState_testv2, config : conf, numShards : 2, nrtReplicas : 2, perReplicaState : true, maxShardsPerNode : 5}}") - .build() - .process(cluster.getSolrClient()); - cluster.waitForActiveCollection(testCollection, 2, 4); - c = cluster.getZkStateReader().getCollection(testCollection); - c.forEachReplica((s, replica) -> assertNotNull(replica.getReplicaState())); - prs = - PerReplicaStates.fetch( - ZkStateReader.getCollectionPath(testCollection), cluster.getZkClient(), null); + PerReplicaStates prs = PerReplicaStates.fetch(collectionPath, cluster.getZkClient(), null); assertEquals(4, prs.states.size()); + + JettySolrRunner jsr = null; + try { + jsr = cluster.startJettySolrRunner(); + + // Now let's do an add replica + CollectionAdminRequest.addReplicaToShard(testCollection, "shard1") + .process(cluster.getSolrClient()); + prs = PerReplicaStates.fetch(collectionPath, cluster.getZkClient(), null); + assertEquals(5, prs.states.size()); + + // create a collection with PRS and v2 API + testCollection = "perReplicaState_testv2"; + collectionPath = ZkStateReader.getCollectionPath(testCollection); + + new V2Request.Builder("/collections") + .withMethod(POST) + .withPayload( + "{create: {name: perReplicaState_testv2, config : conf, numShards : 2, nrtReplicas : 2, perReplicaState : true, maxShardsPerNode : 5}}") + .build() + .process(cluster.getSolrClient()); + cluster.waitForActiveCollection(testCollection, 2, 4); + c = cluster.getZkStateReader().getCollection(testCollection); + c.forEachReplica((s, replica) -> assertNotNull(replica.getReplicaState())); + prs = PerReplicaStates.fetch(collectionPath, cluster.getZkClient(), null); + assertEquals(4, prs.states.size()); + } finally { + if (jsr != null) { + cluster.stopJettySolrRunner(jsr); + } + } } } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java index 0417a4721d5..b405c8733e8 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java @@ -22,7 +22,6 @@ import java.util.Set; import java.util.function.Supplier; import org.apache.lucene.tests.util.LuceneTestCase; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCase; import org.apache.solr.client.solrj.io.eval.TemporalEvaluatorDay; import org.apache.solr.client.solrj.io.eval.TemporalEvaluatorDayOfQuarter; @@ -39,7 +38,6 @@ import org.apache.solr.client.solrj.io.stream.expr.StreamFactory; import org.junit.Test; -@Slow @LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Lucene45"}) public class TestLang extends SolrTestCase { diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphExpressionTest.java index 6b3c5a52a67..faf8d681a28 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphExpressionTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphExpressionTest.java @@ -27,7 +27,6 @@ import java.util.List; import java.util.Set; import org.apache.lucene.tests.util.LuceneTestCase; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrRequest; import org.apache.solr.client.solrj.embedded.JettySolrRunner; import org.apache.solr.client.solrj.impl.HttpSolrClient; @@ -66,7 +65,6 @@ * All base tests will be done with CloudSolrStream. Under the covers CloudSolrStream uses * SolrStream so SolrStream will get fully exercised through these tests. */ -@Slow @LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Lucene45"}) public class GraphExpressionTest extends SolrCloudTestCase { diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphTest.java index 5a669611359..660ff504bf2 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphTest.java @@ -39,7 +39,6 @@ * All base tests will be done with CloudSolrStream. Under the covers CloudSolrStream uses * SolrStream so SolrStream will get fully exercised through these tests. */ -@LuceneTestCase.Slow @LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Lucene45"}) public class GraphTest extends SolrCloudTestCase { diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java index d791574d3f2..fef8335b377 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java @@ -33,7 +33,6 @@ import java.util.SortedSet; import java.util.TreeSet; import org.apache.lucene.tests.util.LuceneTestCase; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.impl.CloudSolrClient; import org.apache.solr.client.solrj.request.CollectionAdminRequest; import org.apache.solr.client.solrj.request.UpdateRequest; @@ -50,7 +49,6 @@ * All base tests will be done with CloudSolrStream. Under the covers CloudSolrStream uses * SolrStream so SolrStream will get fully exercised through these tests. */ -@Slow @LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Lucene45"}) public class JdbcTest extends SolrCloudTestCase { diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java index 623e4da003b..f0f97658b31 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java @@ -26,7 +26,6 @@ import java.util.Map; import java.util.Set; import org.apache.lucene.tests.util.LuceneTestCase; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.embedded.JettySolrRunner; import org.apache.solr.client.solrj.io.SolrClientCache; import org.apache.solr.client.solrj.io.Tuple; @@ -41,7 +40,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow @LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Lucene45"}) public class MathExpressionTest extends SolrCloudTestCase { diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.java index 2cfb22ed2b5..e20871dc3fa 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/SelectWithEvaluatorsTest.java @@ -22,7 +22,6 @@ import java.util.Locale; import java.util.Map; import org.apache.lucene.tests.util.LuceneTestCase; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.io.SolrClientCache; import org.apache.solr.client.solrj.io.Tuple; import org.apache.solr.client.solrj.io.eval.AddEvaluator; @@ -41,7 +40,6 @@ * All base tests will be done with CloudSolrStream. Under the covers CloudSolrStream uses * SolrStream so SolrStream will get fully exercised through these tests. */ -@Slow @LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Lucene45"}) public class SelectWithEvaluatorsTest extends SolrCloudTestCase { diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java index b67bc9addca..34fee1bd09f 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamDecoratorTest.java @@ -27,7 +27,6 @@ import java.util.Locale; import java.util.Map; import org.apache.lucene.tests.util.LuceneTestCase; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.embedded.JettySolrRunner; @@ -72,7 +71,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow @SolrTestCaseJ4.SuppressSSL @LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Lucene45"}) public class StreamDecoratorTest extends SolrCloudTestCase { diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java index 5e3d2454c00..9f09bfd252d 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java @@ -35,7 +35,6 @@ import java.util.stream.IntStream; import java.util.zip.GZIPOutputStream; import org.apache.lucene.tests.util.LuceneTestCase; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.JettySolrRunner; @@ -66,7 +65,6 @@ import org.junit.BeforeClass; import org.junit.Test; -@Slow @SolrTestCaseJ4.SuppressSSL @LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Lucene45"}) @ThreadLeakLingering(linger = 0) diff --git a/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java b/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java index 0202e94f15a..393a10c77c2 100644 --- a/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java +++ b/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java @@ -24,7 +24,6 @@ import java.util.Collections; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.embedded.JettySolrRunner; import org.apache.solr.client.solrj.request.CollectionAdminRequest; @@ -37,7 +36,6 @@ import org.slf4j.LoggerFactory; /** This test would be faster if we simulated the zk state instead. */ -@Slow @LogLevel( "org.apache.solr.common.cloud.PerReplicaStatesOps=DEBUG;org.apache.solr.cloud.Overseer=INFO;org.apache.solr.common.cloud=INFO;org.apache.solr.cloud.api.collections=INFO;org.apache.solr.cloud.overseer=INFO") public class PerReplicaStatesIntegrationTest extends SolrCloudTestCase { 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 d8982b75351..9ea477e8140 100644 --- a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java @@ -78,8 +78,9 @@ /** * Helper base class for distributed search test cases * - *

By default, all tests in sub-classes will be executed with 1, 2, ... DEFAULT_MAX_SHARD_COUNT - * number of shards set up repeatedly. + *

By default, for Nightly runs, all tests in sub-classes will execute with 1, 2, ... + * DEFAULT_MAX_SHARD_COUNT number of shards set up repeatedly. For non-nightly tests, they will + * execute with 2 shards, to speed up total execution time. * *

In general, it's preferable to annotate the tests in sub-classes with a * {@literal @}ShardsFixed(num = N) or a {@literal @}ShardsRepeat(min = M, max = N) to indicate @@ -222,6 +223,11 @@ protected BaseDistributedSearchTestCase(final String context) { this.context = context; this.deadServers = new String[] {DEAD_HOST_1 + context, DEAD_HOST_2 + context, DEAD_HOST_3 + context}; + + // Speed up the test cycle by only running a single configuration instead of the repeat rule + if (TEST_NIGHTLY == false) { + fixShardCount(2); + } } private static final int DEFAULT_MAX_SHARD_COUNT = 3; diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractBasicDistributedZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractBasicDistributedZkTestBase.java index 281cb9a888c..4facbab196c 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractBasicDistributedZkTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractBasicDistributedZkTestBase.java @@ -1084,7 +1084,7 @@ private void testStopAndStartCoresInOneInstance() throws Exception { } /** Create a collection in single node */ - protected void createCollectionInOneInstance( + public static void createCollectionInOneInstance( final SolrClient client, String nodeName, ThreadPoolExecutor executor, diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractChaosMonkeyNothingIsSafeTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractChaosMonkeyNothingIsSafeTestBase.java index 36557655385..8b819e1fd34 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractChaosMonkeyNothingIsSafeTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractChaosMonkeyNothingIsSafeTestBase.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; +import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.impl.CloudLegacySolrClient; import org.apache.solr.client.solrj.impl.CloudSolrClient; @@ -30,6 +31,7 @@ import org.junit.BeforeClass; import org.junit.Test; +@LuceneTestCase.Nightly public abstract class AbstractChaosMonkeyNothingIsSafeTestBase extends AbstractFullDistribZkTestBase { private static final int FAIL_TOLERANCE = 100; diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractChaosMonkeySafeLeaderTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractChaosMonkeySafeLeaderTestBase.java index 3d9ba2f2c9c..a5edbcb7fe2 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractChaosMonkeySafeLeaderTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractChaosMonkeySafeLeaderTestBase.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; +import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.CloudSolrClient; @@ -28,6 +29,7 @@ import org.junit.BeforeClass; import org.junit.Test; +@LuceneTestCase.Nightly public abstract class AbstractChaosMonkeySafeLeaderTestBase extends AbstractFullDistribZkTestBase { private static final Integer RUN_LENGTH = Integer.parseInt(System.getProperty("solr.tests.cloud.cm.runlength", "-1")); 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 3f04a162bca..dfb467a40a2 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 @@ -43,7 +43,6 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrRequest; @@ -112,7 +111,6 @@ * TODO: we should still test this works as a custom update chain as well as what we test now - the * default update chain */ -@Slow public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTestBase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -303,8 +301,13 @@ public static void afterClass() throws Exception { } public AbstractFullDistribZkTestBase() { - sliceCount = 2; - fixShardCount(4); + if (TEST_NIGHTLY) { + sliceCount = 2; + fixShardCount(4); + } else { + sliceCount = 1; + fixShardCount(2); + } // TODO: for now, turn off stress because it uses regular clients, and we // need the cloud client because we kill servers @@ -1534,7 +1537,7 @@ protected String checkShardConsistency(String shard, boolean expectFailure, bool long num = -1; long lastNum = -1; String failMessage = null; - if (verbose) System.err.println("check const of " + shard); + log.debug("check const of {}", shard); int cnt = 0; ZkStateReader zkStateReader = ZkStateReader.from(cloudClient); assertEquals( @@ -1550,8 +1553,9 @@ protected String checkShardConsistency(String shard, boolean expectFailure, bool CloudJettyRunner lastJetty = null; for (CloudJettyRunner cjetty : solrJetties) { ZkNodeProps props = cjetty.info; - if (verbose) System.err.println("client" + cnt++); - if (verbose) System.err.println("PROPS:" + props); + log.debug("client{}", cnt); + log.debug("PROPS:{}", props); + cnt++; try { SolrParams query = @@ -1567,7 +1571,7 @@ protected String checkShardConsistency(String shard, boolean expectFailure, bool // echoed in logs num = cjetty.client.solrClient.query(query).getResults().getNumFound(); } catch (SolrException | SolrServerException e) { - if (verbose) System.err.println("error contacting client: " + e.getMessage() + "\n"); + log.debug("error contacting client: {}", e); continue; } @@ -1576,8 +1580,8 @@ protected String checkShardConsistency(String shard, boolean expectFailure, bool if (zkStateReader.getClusterState().liveNodesContain(nodeName)) { live = true; } - if (verbose) System.err.println(" live:" + live); - if (verbose) System.err.println(" num:" + num + "\n"); + log.debug(" live:{}", live); + log.debug(" num:{}", num); boolean active = Replica.State.getState(props.getStr(ZkStateReader.STATE_PROP)) == Replica.State.ACTIVE; @@ -1625,7 +1629,7 @@ public void showCounts() { for (CloudJettyRunner cjetty : solrJetties) { ZkNodeProps props = cjetty.info; - System.err.println("PROPS:" + props); + log.debug("PROPS:{}", props); try { SolrParams query = @@ -1642,7 +1646,7 @@ public void showCounts() { // anything except be // echoed in logs long num = cjetty.client.solrClient.query(query).getResults().getNumFound(); - System.err.println("DOCS:" + num); + log.debug("DOCS:{}", num); } catch (SolrServerException | SolrException | IOException e) { System.err.println("error contacting client: " + e.getMessage() + "\n"); continue; diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractRecoveryZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractRecoveryZkTestBase.java index d3b685ae692..7c8c696fa8a 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractRecoveryZkTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractRecoveryZkTestBase.java @@ -20,7 +20,6 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.embedded.JettySolrRunner; import org.apache.solr.client.solrj.impl.CloudLegacySolrClient; @@ -36,7 +35,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Slow public abstract class AbstractRecoveryZkTestBase extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractSyncSliceTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractSyncSliceTestBase.java index c106581b961..58c086c96d4 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractSyncSliceTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractSyncSliceTestBase.java @@ -23,22 +23,23 @@ import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.stream.Collectors; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.apache.solr.client.solrj.request.QueryRequest; import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.common.SolrInputDocument; -import org.apache.solr.common.cloud.ClusterState; -import org.apache.solr.common.cloud.DocCollection; import org.apache.solr.common.cloud.Replica; -import org.apache.solr.common.cloud.Slice; import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.common.params.CollectionParams.CollectionAction; import org.apache.solr.common.params.ModifiableSolrParams; +import org.apache.solr.util.LogLevel; import org.junit.Test; /** Test sync phase that occurs when Leader goes down and a new Leader is elected. */ +@LogLevel("org.apache.solr.update.processor.DistributedZkUpdateProcessor=WARN") public abstract class AbstractSyncSliceTestBase extends AbstractFullDistribZkTestBase { private boolean success = false; @@ -170,9 +171,6 @@ public void test() throws Exception { } commit(); - - Thread.sleep(1000); - waitForRecoveriesToFinish(false); // shard should be inconsistent @@ -205,28 +203,20 @@ public void test() throws Exception { success = true; } - private void waitTillAllNodesActive() throws Exception { - for (int i = 0; i < 60; i++) { - Thread.sleep(3000); - ZkStateReader zkStateReader = ZkStateReader.from(cloudClient); - ClusterState clusterState = zkStateReader.getClusterState(); - DocCollection collection1 = clusterState.getCollection("collection1"); - Slice slice = collection1.getSlice("shard1"); - Collection replicas = slice.getReplicas(); - boolean allActive = true; - for (Replica replica : replicas) { - if (!clusterState.liveNodesContain(replica.getNodeName()) - || replica.getState() != Replica.State.ACTIVE) { - allActive = false; - break; - } - } - if (allActive) { - return; - } - } - printLayout(); - fail("timeout waiting to see all nodes active"); + private void waitTillAllNodesActive() throws InterruptedException, TimeoutException { + ZkStateReader zkStateReader = ZkStateReader.from(cloudClient); + + zkStateReader.waitForState( + "collection1", + 3, + TimeUnit.MINUTES, + (n, c) -> { + Collection replicas = c.getSlice("shard1").getReplicas(); + Set nodes = + replicas.stream().map(Replica::getNodeName).collect(Collectors.toSet()); + return replicas.stream().map(Replica::getState).allMatch(Replica.State.ACTIVE::equals) + && n.containsAll(nodes); + }); } private String waitTillInconsistent() throws Exception, InterruptedException { diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractUnloadDistributedZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractUnloadDistributedZkTestBase.java index 85d40fa56d1..4d2de9eaaa6 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractUnloadDistributedZkTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractUnloadDistributedZkTestBase.java @@ -17,6 +17,7 @@ package org.apache.solr.cloud; import java.io.IOException; +import java.lang.invoke.MethodHandles; import java.nio.file.Path; import java.util.Collection; import java.util.Collections; @@ -46,15 +47,19 @@ import org.apache.solr.util.TestInjection; import org.apache.solr.util.TimeOut; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This test simply does a bunch of basic things in solrcloud mode and asserts things work as * expected. */ -public abstract class AbstractUnloadDistributedZkTestBase - extends AbstractBasicDistributedZkTestBase { +public abstract class AbstractUnloadDistributedZkTestBase extends AbstractFullDistribZkTestBase { + private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + public AbstractUnloadDistributedZkTestBase() { super(); + fixShardCount(4); // needs at least 4 servers } protected String getSolrXml() { @@ -69,9 +74,11 @@ public void test() throws Exception { allowPath.clear(); allowPath.add(SolrPaths.ALL_PATH); // Allow non-standard core instance path }); + log.info("###Starting testCoreUnloadAndLeaders"); testCoreUnloadAndLeaders(); // long + log.info("###Starting testUnloadOfCores"); testUnloadLotsOfCores(); // long - + log.info("###Starting testUnloadShardAndCollection"); testUnloadShardAndCollection(); } @@ -391,6 +398,7 @@ private void testCoreUnloadAndLeaders() throws Exception { private void testUnloadLotsOfCores() throws Exception { JettySolrRunner jetty = jettys.get(0); + int shards = TEST_NIGHTLY ? 2 : 1; try (final HttpSolrClient adminClient = (HttpSolrClient) jetty.newClient(15000, 60000)) { int numReplicas = atLeast(3); ThreadPoolExecutor executor = @@ -403,12 +411,18 @@ private void testUnloadLotsOfCores() throws Exception { new SolrNamedThreadFactory("testExecutor")); try { // create the cores - createCollectionInOneInstance( - adminClient, jetty.getNodeName(), executor, "multiunload", 2, numReplicas); + AbstractBasicDistributedZkTestBase.createCollectionInOneInstance( + adminClient, jetty.getNodeName(), executor, "multiunload", shards, numReplicas); } finally { ExecutorUtil.shutdownAndAwaitTermination(executor); } + if (TEST_NIGHTLY == false) { + // with nightly tests, we can try doing the unloads before the creates are done + // it still works, but takes much longer since we end up waiting for a timeout + waitForRecoveriesToFinish("multiunload", false); + } + executor = new ExecutorUtil.MDCAwareThreadPoolExecutor( 0, 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 029de293589..c52ca4e6fc6 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 @@ -64,11 +64,6 @@ public static void azt_beforeClass() throws Exception { initCore("solrconfig.xml", "schema.xml"); } - @Override - public void tearDown() throws Exception { - super.tearDown(); - } - @AfterClass public static void azt_afterClass() throws Exception { @@ -90,8 +85,4 @@ public static void azt_afterClass() throws Exception { zkDir = null; } } - - protected void printLayout() throws Exception { - zkServer.printLayout(); - } } diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java b/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java index 9c3e1cac5f1..f9a17b86275 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java @@ -89,7 +89,8 @@ protected static SolrZkClient zkClient() { } /** - * Call this to configure a cluster of n nodes. + * Call this to configure a cluster of n nodes. It will be shut down automatically after the + * tests. * *

NB you must call {@link MiniSolrCloudCluster.Builder#configure()} to start the cluster * diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCollectionsAPIDistributedZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCollectionsAPIDistributedZkTestBase.java index cc51a857e5f..8cf85dc8505 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCollectionsAPIDistributedZkTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCollectionsAPIDistributedZkTestBase.java @@ -41,7 +41,6 @@ import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.ObjectName; -import org.apache.lucene.tests.util.LuceneTestCase.Slow; import org.apache.lucene.tests.util.TestUtil; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; @@ -72,44 +71,28 @@ import org.apache.solr.core.SolrInfoBean.Category; import org.apache.solr.util.TestInjection; import org.apache.solr.util.TimeOut; -import org.junit.After; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** Tests the Cloud Collections API. */ -@Slow +/** + * Tests the Cloud Collections API. + * + *

Because the different setups require distinct config-sets, we have to push down cluster + * creation to subclasses + */ public abstract class AbstractCollectionsAPIDistributedZkTestBase extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - protected abstract String getConfigSet(); - - @Before - public void setupCluster() throws Exception { + @BeforeClass + public static void setupCluster() { // we don't want this test to have zk timeouts System.setProperty("zkClientTimeout", "60000"); System.setProperty("createCollectionWaitTimeTillActive", "5"); TestInjection.randomDelayInCoreCreation = "true:5"; System.setProperty("validateAfterInactivity", "200"); System.setProperty("solr.allowPaths", "*"); - - configureCluster(4) - .addConfig("conf", configset(getConfigSet())) - .addConfig("conf2", configset(getConfigSet())) - .withSolrXml(TEST_PATH().resolve("solr.xml")) - .configure(); - } - - @After - public void tearDownCluster() throws Exception { - try { - shutdownCluster(); - } finally { - System.clearProperty("createCollectionWaitTimeTillActive"); - System.clearProperty("solr.allowPaths"); - super.tearDown(); - } } @Test diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractIncrementalBackupTest.java b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractIncrementalBackupTest.java index d8763411649..1f77a2b0ba0 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractIncrementalBackupTest.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractIncrementalBackupTest.java @@ -208,7 +208,7 @@ public void testRestoreToOriginalCollection() throws Exception { CollectionAdminRequest.backupCollection(backupCollectionName, backupName) .setLocation(backupLocation) .setRepositoryName(BACKUP_REPO_NAME) - .processAndWait(cluster.getSolrClient(), 10 * 1000); + .processAndWait(cluster.getSolrClient(), 10); assertEquals(RequestStatusState.COMPLETED, result); } final int secondBatchNumDocs = indexDocs(backupCollectionName, true); @@ -223,15 +223,14 @@ public void testRestoreToOriginalCollection() throws Exception { CollectionAdminRequest.restoreCollection(backupCollectionName, backupName) .setLocation(backupLocation) .setRepositoryName(BACKUP_REPO_NAME) - .processAndWait(cluster.getSolrClient(), 20 * 1000); + .processAndWait(cluster.getSolrClient(), 20); assertEquals(RequestStatusState.COMPLETED, result); } assertEquals(firstBatchNumDocs, getNumDocsInCollection(backupCollectionName)); } @Test - @Slow - @SuppressWarnings("rawtypes") + @Nightly public void testBackupIncremental() throws Exception { setTestSuffix("testbackupinc"); CloudSolrClient solrClient = cluster.getSolrClient(); @@ -272,7 +271,7 @@ public void testBackupIncremental() throws Exception { .setBackupLocation(backupLocation) .setBackupRepository(BACKUP_REPO_NAME) .process(cluster.getSolrClient()); - ArrayList backups = (ArrayList) resp.getResponse().get("backups"); + List backups = (List) resp.getResponse().get("backups"); assertEquals(3, backups.size()); // test delete backups @@ -281,14 +280,14 @@ public void testBackupIncremental() throws Exception { .setRepositoryName(BACKUP_REPO_NAME) .setLocation(backupLocation) .process(cluster.getSolrClient()); - assertEquals(null, resp.getResponse().get("deleted")); + assertNull(resp.getResponse().get("deleted")); resp = CollectionAdminRequest.deleteBackupByRecency(backupName, 3) .setRepositoryName(BACKUP_REPO_NAME) .setLocation(backupLocation) .process(cluster.getSolrClient()); - assertEquals(null, resp.getResponse().get("deleted")); + assertNull(resp.getResponse().get("deleted")); resp = CollectionAdminRequest.deleteBackupByRecency(backupName, 2)