mirror of https://github.com/apache/lucene.git
LUCENE-10085: Fix flaky testQueryMatchesCount (#538)
Five times every 10 000 tests, we did not index any documents with i between 0 and 10 (inclusive), which caused the deleted tests to fail. With this commit, we make sure that we always index at least one document between 0 and 10.
This commit is contained in:
parent
5207aae527
commit
9974f6ac34
|
@ -222,7 +222,8 @@ public class TestDocValuesFieldExistsQuery extends LuceneTestCase {
|
||||||
|
|
||||||
for (int i = 0; i < randomNumDocs; i++) {
|
for (int i = 0; i < randomNumDocs; i++) {
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
if (random().nextBoolean()) {
|
// ensure we index at least a document with long between 0 and 10
|
||||||
|
if (i == 0 || random().nextBoolean()) {
|
||||||
doc.add(new LongPoint("long", i));
|
doc.add(new LongPoint("long", i));
|
||||||
doc.add(new NumericDocValuesField("long", i));
|
doc.add(new NumericDocValuesField("long", i));
|
||||||
doc.add(new StringField("string", "value", Store.NO));
|
doc.add(new StringField("string", "value", Store.NO));
|
||||||
|
|
Loading…
Reference in New Issue