From cf67e6eb58d3972214fa977e084ff1298beadcc1 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Wed, 27 Apr 2011 15:55:33 +0000 Subject: [PATCH] LUCENE-3023: fixed test case to not depend on num cpus git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/realtime_search@1097158 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/index/TestFlushByRamOrCountsPolicy.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lucene/src/test/org/apache/lucene/index/TestFlushByRamOrCountsPolicy.java b/lucene/src/test/org/apache/lucene/index/TestFlushByRamOrCountsPolicy.java index 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 @Override public 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);