You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2020/08/12 11:47:05 UTC

[lucene-solr] branch master updated: SOLR-14470: Fix test failures by reducing the randomness of test data.

This is an automated email from the ASF dual-hosted git repository.

ab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new a5543df  SOLR-14470: Fix test failures by reducing the randomness of test data.
a5543df is described below

commit a5543dfb5112d12b9616f2d09cd07e9805b177de
Author: Andrzej Bialecki <ab...@apache.org>
AuthorDate: Wed Aug 12 13:45:25 2020 +0200

    SOLR-14470: Fix test failures by reducing the randomness of test data.
---
 .../org/apache/solr/handler/export/TestExportWriter.java | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.java b/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.java
index a044d5b..db27ee1 100644
--- a/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.java
+++ b/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.java
@@ -717,10 +717,8 @@ public class TestExportWriter extends SolrTestCaseJ4 {
       for (int j = 0; j < BATCH_SIZE; j++) {
         docs[j] = new SolrInputDocument(
             "id", String.valueOf(i * BATCH_SIZE + j),
-            "batch_i_p", String.valueOf(i),
-            "random_i_p", String.valueOf(random().nextInt(BATCH_SIZE)),
             "sortabledv", TestUtil.randomSimpleString(random(), 2, 3),
-            "sortabledv_udvas", String.valueOf(random().nextInt(100)),
+            "sortabledv_udvas", String.valueOf((i + j) % 101),
             "small_i_p", String.valueOf((i + j) % 37)
             );
       }
@@ -746,8 +744,8 @@ public class TestExportWriter extends SolrTestCaseJ4 {
     Map<String, Object> rspMap = mapper.readValue(rsp, HashMap.class);
     List<Map<String, Object>> docs = (List<Map<String, Object>>) Utils.getObjectByPath(rspMap, false, "/response/docs");
     assertNotNull("missing document results: " + rspMap, docs);
-    assertEquals("wrong number of unique docs", 100, docs.size());
-    for (int i = 0; i < 99; i++) {
+    assertEquals("wrong number of unique docs", 101, docs.size());
+    for (int i = 0; i < 100; i++) {
       boolean found = false;
       String si = String.valueOf(i);
       for (int j = 0; j < docs.size(); j++) {
@@ -763,14 +761,14 @@ public class TestExportWriter extends SolrTestCaseJ4 {
     rspMap = mapper.readValue(rsp, HashMap.class);
     docs = (List<Map<String, Object>>) Utils.getObjectByPath(rspMap, false, "/response/docs");
     assertNotNull("missing document results: " + rspMap, docs);
-    assertEquals("wrong number of unique docs", 100, docs.size());
+    assertEquals("wrong number of unique docs", 101, docs.size());
     for (Map<String, Object> doc : docs) {
       assertNotNull("missing sum: " + doc, doc.get("sum(small_i_p)"));
-      assertEquals(18000.0, ((Number)doc.get("sum(small_i_p)")).doubleValue(), 2500.0);
+      assertEquals(18000.0, ((Number)doc.get("sum(small_i_p)")).doubleValue(), 1000.0);
       assertNotNull("missing avg: " + doc, doc.get("avg(small_i_p)"));
-      assertEquals(18.0, ((Number)doc.get("avg(small_i_p)")).doubleValue(), 2.5);
+      assertEquals(18.0, ((Number)doc.get("avg(small_i_p)")).doubleValue(), 1.0);
       assertNotNull("missing count: " + doc, doc.get("count(*)"));
-      assertEquals(1000.0, ((Number)doc.get("count(*)")).doubleValue(), 200.0);
+      assertEquals(1000.0, ((Number)doc.get("count(*)")).doubleValue(), 100.0);
     }
     // try invalid field types
     req = req("q", "*:*", "qt", "/export", "fl", "id,sortabledv,small_i_p", "sort", "sortabledv asc", "expr", "unique(input(),over=\"sortabledv\")");