From fad963cf2fa102b2ec644b4342ccc811bd92e582 Mon Sep 17 00:00:00 2001 From: markrmiller Date: Sun, 19 Feb 2017 16:34:33 -0500 Subject: [PATCH] SOLR-10164: DistributedVersionInfoTest needs to be hardened. --- .../apache/solr/cloud/DistributedVersionInfoTest.java | 11 +++++++---- .../java/org/apache/solr/cloud/SolrCloudTestCase.java | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) 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 b70cd5e3fc5..0394152ce25 100644 --- a/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java @@ -201,10 +201,13 @@ public class DistributedVersionInfoTest extends SolrCloudTestCase { Thread.sleep(rand.nextInt(50)+1); } catch (InterruptedException e) {} - int docToDelete = rand.nextInt(docsSent.get())+1; - if (!deletedDocs.contains(docToDelete)) { - delI(String.valueOf(docToDelete)); - deletedDocs.add(docToDelete); + int ds = docsSent.get(); + if (ds > 0) { + int docToDelete = rand.nextInt(ds) + 1; + if (!deletedDocs.contains(docToDelete)) { + delI(String.valueOf(docToDelete)); + deletedDocs.add(docToDelete); + } } } } 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 7fc82578a72..180cf6e88af 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 @@ -70,7 +70,7 @@ import org.junit.Before; */ public class SolrCloudTestCase extends SolrTestCaseJ4 { - public static final int DEFAULT_TIMEOUT = 60; + public static final int DEFAULT_TIMEOUT = 90; private static class Config { final String name;