Apache Solr open-source search software
LUCENE-3023: fixed test case to not depend on num cpus
Simon Willnauercf67e6eb58d3
diff --git a/lucene/src/test/org/apache/lucene/index/TestFlushByRamOrCountsPolicy.java b/lucene/src/test/org/apache/lucene/index/TestFlushByRamOrCountsPolicy.javaindex 7560b00b17f..40d0f79fa1a 100644--- a/lucene/src/test/org/apache/lucene/index/TestFlushByRamOrCountsPolicy.java+++ b/lucene/src/test/org/apache/lucene/index/TestFlushByRamOrCountsPolicy.java@@ -36,27 +36,25 @@ import org.junit.Before;public class TestFlushByRamOrCountsPolicy extends LuceneTestCase {private LineFileDocs lineDocFile;- private int numCPUs;@Before@Overridepublic void setUp() throws Exception {super.setUp();lineDocFile = new LineFileDocs(random);- numCPUs = Runtime.getRuntime().availableProcessors();}public void testFlushByRam() throws CorruptIndexException,LockObtainFailedException, IOException, InterruptedException {- int[] numThreads = new int[] { numCPUs + random.nextInt(numCPUs + 1), 1 };+ int[] numThreads = new int[] { 3 + random.nextInt(12), 1 };for (int i = 0; i < numThreads.length; i++) {runFlushByRam(numThreads[i],1 + random.nextInt(10) + random.nextDouble(), false);}for (int i = 0; i < numThreads.length; i++) {- // with a 250 mb ram buffer we should never stall- runFlushByRam(numThreads[i], 250.d, true);+ // with a 512 mb ram buffer we should never stall+ runFlushByRam(numThreads[i], 512.d, true);}}@@ -117,7 +115,7 @@ public class TestFlushByRamOrCountsPolicy extends LuceneTestCase {public void testFlushDocCount() throws CorruptIndexException,LockObtainFailedException, IOException, InterruptedException {- int[] numThreads = new int[] { numCPUs + random.nextInt(numCPUs + 1), 1 };+ int[] numThreads = new int[] { 3 + random.nextInt(12), 1 };for (int i = 0; i < numThreads.length; i++) {final int numDocumentsToIndex = 50 + random.nextInt(150);