Apache Lucene open-source search software
LUCENE-3168: Enable Throttling only during nightly builds
Simon Willnauerac2c62554d9f
diff --git a/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java b/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.javaindex 655d81b092a..322461e7645 100644--- a/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java+++ b/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java@@ -60,6 +60,7 @@ import org.apache.lucene.store.Directory;import org.apache.lucene.store.FSDirectory;import org.apache.lucene.store.LockFactory;import org.apache.lucene.store.MockDirectoryWrapper;+import org.apache.lucene.store.MockDirectoryWrapper.Throttling;import org.apache.lucene.util.FieldCacheSanityChecker.Insanity;import org.junit.*;import org.junit.rules.TestWatchman;@@ -160,6 +161,8 @@ public abstract class LuceneTestCase extends Assert {public static final String TEST_LINE_DOCS_FILE = System.getProperty("tests.linedocsfile", "europarl.lines.txt.gz");/** whether or not to clean threads between test invocations: "false", "perMethod", "perClass" */public static final String TEST_CLEAN_THREADS = System.getProperty("tests.cleanthreads", "perClass");+ /** whether or not to clean threads between test invocations: "false", "perMethod", "perClass" */+ public static final Throttling TEST_THROTTLING = TEST_NIGHTLY ? Throttling.SOMETIMES : Throttling.NEVER;private static final Pattern codecWithParam = Pattern.compile("(.*)\\(\\s*(\\d+)\\s*\\)");@@ -938,8 +941,9 @@ public abstract class LuceneTestCase extends Assert {Directory impl = newDirectoryImpl(r, TEST_DIRECTORY);MockDirectoryWrapper dir = new MockDirectoryWrapper(r, impl);stores.put(dir, Thread.currentThread().getStackTrace());+ dir.setThrottling(TEST_THROTTLING);return dir;- }+ }/*** Returns a new Directory instance, with contents copied from the@@ -985,6 +989,7 @@ public abstract class LuceneTestCase extends Assert {dir.setLockFactory(lf);}stores.put(dir, Thread.currentThread().getStackTrace());+ dir.setThrottling(TEST_THROTTLING);return dir;} catch (Exception e) {throw new RuntimeException(e);@@ -1003,6 +1008,7 @@ public abstract class LuceneTestCase extends Assert {}MockDirectoryWrapper dir = new MockDirectoryWrapper(r, impl);stores.put(dir, Thread.currentThread().getStackTrace());+ dir.setThrottling(TEST_THROTTLING);return dir;}