You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/07/09 21:02:03 UTC
[lucene-solr] 21/23: more test tweaks
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit 1145b8c83e7dba857837fb46457ed3d48ca4f938
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Wed Jul 8 16:00:14 2020 -0500
more test tweaks
---
.../org/apache/solr/TestDistributedGrouping.java | 162 ++++++++++++++-------
.../solr/cloud/ChaosMonkeyNothingIsSafeTest.java | 2 +-
.../solr/cloud/ChaosMonkeySafeLeaderTest.java | 2 +
.../apache/solr/search/facet/TestJsonFacets.java | 25 +++-
4 files changed, 133 insertions(+), 58 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java
index 9b88fbf..9424653 100644
--- a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java
+++ b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java
@@ -23,6 +23,7 @@ import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.ParWork;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
@@ -319,56 +320,119 @@ public class TestDistributedGrouping extends BaseDistributedSearchTestCase {
// We validate distributed grouping with scoring as first sort.
// note: this 'q' matches all docs and returns the 'id' as the score, which is unique and so our results should be deterministic.
handle.put("maxScore", SKIP);// TODO see SOLR-6612
- query("q", "{!func}id_i1", "rows", 100, "fl", "score,id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " desc", "group.sort", "score desc"); // SOLR-2955
- query("q", "{!func}id_i1", "rows", 100, "fl", "score,id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", "score desc, _docid_ asc, id asc");
- query("q", "{!func}id_i1", "rows", 100, "fl", "score,id," + i1, "group", "true", "group.field", i1, "group.limit", -1);
- query("q", "*:*",
- "group", "true",
- "group.query", t1 + ":kings OR " + t1 + ":eggs", "group.limit", "3",
- "fl", "id,score", "sort", i1 + " asc, id asc");
- query("q", "*:*",
- "group", "true",
- "group.query", t1 + ":kings OR " + t1 + ":eggs", "group.limit", "3",
- "fl", "id,score", "group.format", "simple", "sort", i1 + " asc, id asc");
- query("q", "*:*",
- "group", "true",
- "group.query", t1 + ":kings OR " + t1 + ":eggs", "group.limit", "3",
- "fl", "id,score", "group.main", "true", "sort", i1 + " asc, id asc");
-
- // grouping shouldn't care if there are multiple fl params, or what order the fl field names are in
- variantQuery(params("q", "*:*",
- "group", "true", "group.field", i1dv, "group.limit", "10",
- "sort", i1 + " asc, id asc")
- , params("fl", "id," + i1dv)
- , params("fl", i1dv + ",id")
- , params("fl", "id", "fl", i1dv)
- , params("fl", i1dv, "fl", "id")
- );
- variantQuery(params("q", "*:*", "rows", "100",
- "group", "true", "group.field", s1dv, "group.limit", "-1",
- "sort", b1dv + " asc, id asc",
- "group.sort", "id desc")
- , params("fl", "id," + s1dv + "," + tdate_a)
- , params("fl", "id", "fl", s1dv, "fl", tdate_a)
- , params("fl", tdate_a, "fl", s1dv, "fl", "id")
- );
- variantQuery(params("q", "*:*", "rows", "100",
- "group", "true", "group.field", s1dv, "group.limit", "-1",
- "sort", b1dv + " asc, id asc",
- "group.sort", "id desc")
- , params("fl", s1dv + "," + tdate_a)
- , params("fl", s1dv, "fl", tdate_a)
- , params("fl", tdate_a, "fl", s1dv)
- );
- variantQuery(params("q", "{!func}id_i1", "rows", "100",
- "group", "true", "group.field", i1, "group.limit", "-1",
- "sort", tlong+" asc, id desc")
- , params("fl", t1 + ",score," + i1dv)
- , params("fl", t1, "fl", "score", "fl", i1dv)
- , params("fl", "score", "fl", t1, "fl", i1dv)
- );
-
+ try (ParWork worker = new ParWork(this)) {
+ worker.collect(()->{
+ try {
+ query("q", "{!func}id_i1", "rows", 100, "fl", "score,id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " desc", "group.sort", "score desc"); // SOLR-2955
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ worker.collect(()->{
+ try {
+ query("q", "{!func}id_i1", "rows", 100, "fl", "score,id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", "score desc, _docid_ asc, id asc");
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ worker.collect(()->{
+ try {
+ query("q", "{!func}id_i1", "rows", 100, "fl", "score,id," + i1, "group", "true", "group.field", i1, "group.limit", -1);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ worker.collect(()->{
+ try {
+ query("q", "*:*",
+ "group", "true",
+ "group.query", t1 + ":kings OR " + t1 + ":eggs", "group.limit", "3",
+ "fl", "id,score", "sort", i1 + " asc, id asc");
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ worker.collect(()->{
+ try {
+ query("q", "*:*",
+ "group", "true",
+ "group.query", t1 + ":kings OR " + t1 + ":eggs", "group.limit", "3",
+ "fl", "id,score", "group.format", "simple", "sort", i1 + " asc, id asc");
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ worker.collect(()->{
+ try {
+ query("q", "*:*",
+ "group", "true",
+ "group.query", t1 + ":kings OR " + t1 + ":eggs", "group.limit", "3",
+ "fl", "id,score", "group.main", "true", "sort", i1 + " asc, id asc");
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+
+ worker.collect(()->{
+ try {
+ // grouping shouldn't care if there are multiple fl params, or what order the fl field names are in
+ variantQuery(params("q", "*:*",
+ "group", "true", "group.field", i1dv, "group.limit", "10",
+ "sort", i1 + " asc, id asc")
+ , params("fl", "id," + i1dv)
+ , params("fl", i1dv + ",id")
+ , params("fl", "id", "fl", i1dv)
+ , params("fl", i1dv, "fl", "id")
+ );
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ worker.collect(()->{
+ try {
+ variantQuery(params("q", "*:*", "rows", "100",
+ "group", "true", "group.field", s1dv, "group.limit", "-1",
+ "sort", b1dv + " asc, id asc",
+ "group.sort", "id desc")
+ , params("fl", "id," + s1dv + "," + tdate_a)
+ , params("fl", "id", "fl", s1dv, "fl", tdate_a)
+ , params("fl", tdate_a, "fl", s1dv, "fl", "id")
+ );
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ worker.collect(()->{
+ try {
+ variantQuery(params("q", "*:*", "rows", "100",
+ "group", "true", "group.field", s1dv, "group.limit", "-1",
+ "sort", b1dv + " asc, id asc",
+ "group.sort", "id desc")
+ , params("fl", s1dv + "," + tdate_a)
+ , params("fl", s1dv, "fl", tdate_a)
+ , params("fl", tdate_a, "fl", s1dv)
+ );
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ worker.collect(()->{
+ try {
+ variantQuery(params("q", "{!func}id_i1", "rows", "100",
+ "group", "true", "group.field", i1, "group.limit", "-1",
+ "sort", tlong+" asc, id desc")
+ , params("fl", t1 + ",score," + i1dv)
+ , params("fl", t1, "fl", "score", "fl", i1dv)
+ , params("fl", "score", "fl", t1, "fl", i1dv)
+ );
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ worker.addCollect("someTestQueries");
+ }
+
// some explicit checks of non default sorting, and sort/group.sort with diff clauses
query("q", "{!func}id_i1", "rows", 100, "fl", tlong + ",id," + i1, "group", "true",
"group.field", i1, "group.limit", -1,
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 b0f4d8c..de1ec01 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
@@ -240,7 +240,7 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase
+ ") - we expect it can happen, but shouldn't easily", failCount > FAIL_TOLERANCE);
}
}
-
+
waitForRecoveriesToFinish(false);
commit();
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 9765718..827a4a5 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java
@@ -153,6 +153,8 @@ public class ChaosMonkeySafeLeaderTest extends AbstractFullDistribZkTestBase {
waitForRecoveriesToFinish(false);
+ commit();
+
checkShardConsistency(batchSize == 1, true);
if (VERBOSE) System.out.println("control docs:" + controlClient.query(new SolrQuery("*:*")).getResults().getNumFound() + "\n\n");
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 514dae2..2678f91 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
@@ -1135,7 +1135,7 @@ public class TestJsonFacets extends SolrTestCaseHS {
int limit=0;
switch (random().nextInt(4)) {
case 0: limit=-1; break;
- case 1: limit=1000000; break;
+ case 1: limit=(TEST_NIGHTLY ? 1000000 : 10); break;
case 2: // fallthrough
case 3: // fallthrough
}
@@ -2988,7 +2988,7 @@ public class TestJsonFacets extends SolrTestCaseHS {
int numCat = 1;
int numWhere = 2000000000;
int commitPercent = 10;
- int ndocs=1000;
+ int ndocs=TEST_NIGHTLY ? 1000 : 100;
Map<Integer, Map<Integer, List<Integer>>> model = new HashMap<>(); // cat->where->list<ids>
for (int i=0; i<ndocs; i++) {
@@ -3033,12 +3033,21 @@ public class TestJsonFacets extends SolrTestCaseHS {
);
}
- client.testJQ(params(p, "q", "*:*"
- , "json.facet", "{f1:{type:terms, field:id, limit:1, offset:990}}"
- )
- , "facets=={ 'count':" + ndocs + "," +
- "'f1':{buckets:[{val:'00990',count:1}]}} "
- );
+ if (TEST_NIGHTLY) {
+ client.testJQ(params(p, "q", "*:*"
+ , "json.facet", "{f1:{type:terms, field:id, limit:1, offset:990}}"
+ )
+ , "facets=={ 'count':" + ndocs + "," +
+ "'f1':{buckets:[{val:'00990',count:1}]}} "
+ );
+ } else {
+ client.testJQ(params(p, "q", "*:*"
+ , "json.facet", "{f1:{type:terms, field:id, limit:1, offset:90}}"
+ )
+ , "facets=={ 'count':" + ndocs + "," +
+ "'f1':{buckets:[{val:'00090',count:1}]}} "
+ );
+ }
for (int i=0; i<20; i++) {