You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2021/12/14 09:51:04 UTC

[lucene] branch branch_9x updated: LUCENE-10085: Fix flaky testQueryMatchesCount (#538)

This is an automated email from the ASF dual-hosted git repository.

ivera pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 352a6b6  LUCENE-10085: Fix flaky testQueryMatchesCount (#538)
352a6b6 is described below

commit 352a6b68f0dfc6847e81bcd41a4c66b86494e2b4
Author: Quentin Pradet <qu...@apache.org>
AuthorDate: Tue Dec 14 13:49:58 2021 +0400

    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.
---
 .../test/org/apache/lucene/search/TestDocValuesFieldExistsQuery.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lucene/core/src/test/org/apache/lucene/search/TestDocValuesFieldExistsQuery.java b/lucene/core/src/test/org/apache/lucene/search/TestDocValuesFieldExistsQuery.java
index 489ee0f..ef40061 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestDocValuesFieldExistsQuery.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestDocValuesFieldExistsQuery.java
@@ -222,7 +222,8 @@ public class TestDocValuesFieldExistsQuery extends LuceneTestCase {
 
     for (int i = 0; i < randomNumDocs; i++) {
       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 NumericDocValuesField("long", i));
         doc.add(new StringField("string", "value", Store.NO));