diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java b/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java index 5535b11df0a..f8bfd0ed66b 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java @@ -37,17 +37,17 @@ import java.util.Random; * Compares one codec against another */ public class TestDuelingCodecs extends LuceneTestCase { - private Directory leftDir; - private IndexReader leftReader; - private Codec leftCodec; + Directory leftDir; + IndexReader leftReader; + Codec leftCodec; - private Directory rightDir; - private IndexReader rightReader; - private Codec rightCodec; - private RandomIndexWriter leftWriter; - private RandomIndexWriter rightWriter; - private long seed; - private String info; // for debugging + Directory rightDir; + IndexReader rightReader; + Codec rightCodec; + RandomIndexWriter leftWriter; + RandomIndexWriter rightWriter; + long seed; + String info; // for debugging @Override public void setUp() throws Exception { @@ -143,8 +143,9 @@ public class TestDuelingCodecs extends LuceneTestCase { /** * checks the two indexes are equivalent */ + // we use a small amount of docs here, so it works with any codec public void testEquals() throws IOException { - int numdocs = TEST_NIGHTLY ? atLeast(2000) : atLeast(100); + int numdocs = atLeast(100); createRandomIndex(numdocs, leftWriter, seed); createRandomIndex(numdocs, rightWriter, seed); diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecsAtNight.java b/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecsAtNight.java new file mode 100644 index 00000000000..08479b4e526 --- /dev/null +++ b/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecsAtNight.java @@ -0,0 +1,41 @@ +package org.apache.lucene.index; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.lucene.util.LuceneTestCase.Nightly; +import org.apache.lucene.util.LuceneTestCase.SuppressCodecs; + +/** + * Just like TestDuelingCodecs, only with a lot more documents. + */ +@Nightly +@SuppressCodecs({"Memory", "Direct"}) // it can be too much for these codecs +public class TestDuelingCodecsAtNight extends TestDuelingCodecs { + + // use a big number of documents + public void testBigEquals() throws Exception { + int numdocs = atLeast(2000); + createRandomIndex(numdocs, leftWriter, seed); + createRandomIndex(numdocs, rightWriter, seed); + + leftReader = leftWriter.getReader(); + rightReader = rightWriter.getReader(); + + assertReaderEquals(info, leftReader, rightReader); + } +}