lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject lucene-solr:branch_7x: SOLR-12181: Fix test failures.
Date Mon, 16 Apr 2018 11:16:43 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 8eb6ed463 -> 626435c81


SOLR-12181: Fix test failures.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/626435c8
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/626435c8
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/626435c8

Branch: refs/heads/branch_7x
Commit: 626435c810e876f36a5b69561b8e901e56d00bb4
Parents: 8eb6ed4
Author: Andrzej Bialecki <ab@apache.org>
Authored: Mon Apr 16 13:15:33 2018 +0200
Committer: Andrzej Bialecki <ab@apache.org>
Committed: Mon Apr 16 13:16:37 2018 +0200

----------------------------------------------------------------------
 .../cloud/autoscaling/IndexSizeTriggerTest.java | 26 +++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/626435c8/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerTest.java
b/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerTest.java
index 3bf7021..265a6c6 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/IndexSizeTriggerTest.java
@@ -20,6 +20,7 @@ package org.apache.solr.cloud.autoscaling;
 import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -29,7 +30,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrRequest;
@@ -39,12 +39,14 @@ import org.apache.solr.client.solrj.cloud.autoscaling.Suggester;
 import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventProcessorStage;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.cloud.CloudTestUtils;
 import org.apache.solr.cloud.SolrCloudTestCase;
 import org.apache.solr.cloud.autoscaling.sim.SimCloudManager;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.cloud.ZkNodeProps;
 import org.apache.solr.common.params.CollectionParams;
+import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.Pair;
 import org.apache.solr.common.util.TimeSource;
@@ -65,7 +67,6 @@ import static org.apache.solr.common.cloud.ZkStateReader.SOLR_AUTOSCALING_CONF_P
  *
  */
 @LogLevel("org.apache.solr.cloud.autoscaling=DEBUG")
-@LuceneTestCase.AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-12181")
 public class IndexSizeTriggerTest extends SolrCloudTestCase {
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
@@ -457,6 +458,25 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
     }
     solrClient.commit(collectionName);
 
+    // check the actual size of shard to set the threshold
+    QueryResponse rsp = solrClient.query(params(CommonParams.QT, "/admin/metrics", "group",
"core"));
+    NamedList<Object> nl = rsp.getResponse();
+    nl = (NamedList<Object>)nl.get("metrics");
+    int maxSize = 0;
+    for (Iterator<Map.Entry<String, Object>> it = nl.iterator(); it.hasNext();
) {
+      Map.Entry<String, Object> e = it.next();
+      NamedList<Object> metrics = (NamedList<Object>)e.getValue();
+      Object o = metrics.get("INDEX.sizeInBytes");
+      assertNotNull("INDEX.sizeInBytes missing: " + metrics, o);
+      assertTrue("not a number", o instanceof Number);
+      if (maxSize < ((Number)o).intValue()) {
+        maxSize = ((Number)o).intValue();
+      }
+    }
+    assertTrue("maxSize should be non-zero", maxSize > 0);
+
+    int aboveBytes = maxSize * 2 / 3;
+
     long waitForSeconds = 3 + random().nextInt(5);
 
     // the trigger is initially disabled so that we have time to add listeners
@@ -471,7 +491,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
         // hit this limit when deleting
         "'belowDocs' : 100," +
         // hit this limit when indexing
-        "'aboveBytes' : 150000," +
+        "'aboveBytes' : " + aboveBytes + "," +
         // don't hit this limit when deleting
         "'belowBytes' : 10," +
         "'enabled' : false," +


Mime
View raw message