don't let virus checker run when testing merge stability

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1621432 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-08-30 08:52:25 +00:00
parent 24e22029ce
commit 21e2609d40
1 changed files with 12 additions and 1 deletions

View File

@ -35,6 +35,7 @@ import org.apache.lucene.codecs.mockrandom.MockRandomPostingsFormat;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.util.CloseableThreadLocal; import org.apache.lucene.util.CloseableThreadLocal;
import org.apache.lucene.util.InfoStream; import org.apache.lucene.util.InfoStream;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;
@ -82,7 +83,7 @@ abstract class BaseIndexFileFormatTestCase extends LuceneTestCase {
this.root = root; this.root = root;
} }
public long accumulateObject(Object o, long shallowSize, java.util.Map<Field, Object> fieldValues, java.util.Collection<Object> queue) { public long accumulateObject(Object o, long shallowSize, Map<Field, Object> fieldValues, Collection<Object> queue) {
for (Class<?> clazz = o.getClass(); clazz != null; clazz = clazz.getSuperclass()) { for (Class<?> clazz = o.getClass(); clazz != null; clazz = clazz.getSuperclass()) {
if (EXCLUDED_CLASSES.contains(clazz) && o != root) { if (EXCLUDED_CLASSES.contains(clazz) && o != root) {
return 0; return 0;
@ -166,6 +167,11 @@ abstract class BaseIndexFileFormatTestCase extends LuceneTestCase {
/** The purpose of this test is to make sure that bulk merge doesn't accumulate useless data over runs. */ /** The purpose of this test is to make sure that bulk merge doesn't accumulate useless data over runs. */
public void testMergeStability() throws Exception { public void testMergeStability() throws Exception {
Directory dir = newDirectory(); Directory dir = newDirectory();
if (dir instanceof MockDirectoryWrapper) {
// Else, the virus checker may prevent deletion of files and cause
// us to see too many bytes used by extension in the end:
((MockDirectoryWrapper) dir).setEnableVirusScanner(false);
}
// do not use newMergePolicy that might return a MockMergePolicy that ignores the no-CFS ratio // do not use newMergePolicy that might return a MockMergePolicy that ignores the no-CFS ratio
// do not use RIW which will change things up! // do not use RIW which will change things up!
MergePolicy mp = newTieredMergePolicy(); MergePolicy mp = newTieredMergePolicy();
@ -184,6 +190,11 @@ abstract class BaseIndexFileFormatTestCase extends LuceneTestCase {
IndexReader reader = DirectoryReader.open(dir); IndexReader reader = DirectoryReader.open(dir);
Directory dir2 = newDirectory(); Directory dir2 = newDirectory();
if (dir2 instanceof MockDirectoryWrapper) {
// Else, the virus checker may prevent deletion of files and cause
// us to see too many bytes used by extension in the end:
((MockDirectoryWrapper) dir2).setEnableVirusScanner(false);
}
mp = newTieredMergePolicy(); mp = newTieredMergePolicy();
mp.setNoCFSRatio(0); mp.setNoCFSRatio(0);
cfg = new IndexWriterConfig(new MockAnalyzer(random())).setUseCompoundFile(false).setMergePolicy(mp); cfg = new IndexWriterConfig(new MockAnalyzer(random())).setUseCompoundFile(false).setMergePolicy(mp);