From 81a557ab16fe0712d9755d37f5c932a14a019618 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Thu, 27 Nov 2014 00:45:32 +0000 Subject: [PATCH] more test speedups git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1641972 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/index/BaseIndexFileFormatTestCase.java | 1 + .../java/org/apache/lucene/store/MockDirectoryWrapper.java | 4 ++-- .../src/java/org/apache/lucene/util/LuceneTestCase.java | 2 +- .../src/java/org/apache/lucene/util/ThrottledIndexOutput.java | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseIndexFileFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseIndexFileFormatTestCase.java index 83209ac4745..05cace127b5 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseIndexFileFormatTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseIndexFileFormatTestCase.java @@ -211,6 +211,7 @@ abstract class BaseIndexFileFormatTestCase extends LuceneTestCase { } /** Test the accuracy of the ramBytesUsed estimations. */ + @Slow public void testRamBytesUsed() throws IOException { if (Codec.getDefault() instanceof RandomCodec) { // this test relies on the fact that two segments will be written with diff --git a/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java b/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java index bfe9f83f0d1..cea731bb6c7 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java +++ b/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java @@ -127,7 +127,7 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper { // not be reproducible from the original seed this.randomState = new Random(random.nextInt()); this.throttledOutput = new ThrottledIndexOutput(ThrottledIndexOutput - .mBitsToBytes(40 + randomState.nextInt(10)), 5 + randomState.nextInt(5), null); + .mBitsToBytes(40 + randomState.nextInt(10)), 1 + randomState.nextInt(5), null); init(); } @@ -180,7 +180,7 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper { public static enum Throttling { /** always emulate a slow hard disk. could be very slow! */ ALWAYS, - /** sometimes (2% of the time) emulate a slow hard disk. */ + /** sometimes (0.5% of the time) emulate a slow hard disk. */ SOMETIMES, /** never throttle output */ NEVER diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java index c794f9e91c3..78b4da71a81 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java @@ -1315,7 +1315,7 @@ public abstract class LuceneTestCase extends Assert { } if (rarely(random) && !bare) { - final double maxMBPerSec = 10 + 5*(random.nextDouble()-0.5); + final double maxMBPerSec = TestUtil.nextInt(random, 20, 40); if (LuceneTestCase.VERBOSE) { System.out.println("LuceneTestCase: will rate limit output IndexOutput to " + maxMBPerSec + " MB/sec"); } diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/ThrottledIndexOutput.java b/lucene/test-framework/src/java/org/apache/lucene/util/ThrottledIndexOutput.java index 1c93bf8ef7e..c7a9cbef883 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/util/ThrottledIndexOutput.java +++ b/lucene/test-framework/src/java/org/apache/lucene/util/ThrottledIndexOutput.java @@ -53,7 +53,7 @@ public class ThrottledIndexOutput extends IndexOutput { } public static final int mBitsToBytes(int mbits) { - return mbits * 125000; + return mbits * 125000000; } public ThrottledIndexOutput(int bytesPerSecond, long flushDelayMillis,