Skip to content

Apache Lucene open-source search software

SOLR-13479: Harden OverseerTaskQueueTest

Jan Høydahl18cb42ee8085
diff --git a/solr/core/src/test/org/apache/solr/cloud/DistributedQueueTest.java b/solr/core/src/test/org/apache/solr/cloud/DistributedQueueTest.java
index c67f79e86b7..7b9ae11cb40 100644
--- a/solr/core/src/test/org/apache/solr/cloud/DistributedQueueTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/DistributedQueueTest.java
@@ -274,8 +274,8 @@ public class DistributedQueueTest extends SolrTestCaseJ4 {
// The 4th element in the queue will end with a "3".
return child.endsWith("3");
}).size());
- assertTrue(System.nanoTime() - start < TimeUnit.MILLISECONDS.toNanos(1000));
- assertTrue(System.nanoTime() - start >= TimeUnit.MILLISECONDS.toNanos(250));
+ long timeTaken = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
+ assertTrue("Time was " + timeTaken + "ms, expected 250-1500ms", timeTaken > 250 && timeTaken < 1500);
}
private void forceSessionExpire() throws InterruptedException, TimeoutException {