Skip to content

Fix seed-dependent failure in TestForceNoBulkScoringQuery#16369

Merged
dweiss merged 1 commit into
apache:mainfrom
jeho-rpls:fix-monitor-bulkscoring-test
Jul 7, 2026
Merged

Fix seed-dependent failure in TestForceNoBulkScoringQuery#16369
dweiss merged 1 commit into
apache:mainfrom
jeho-rpls:fix-monitor-bulkscoring-test

Conversation

@jeho-rpls

Copy link
Copy Markdown
Contributor

TestForceNoBulkScoringQuery#testBulkScoringIsDisabled fails deterministically with some seeds since #16350, e.g. on current main:

gradlew -p lucene/monitor test --tests TestForceNoBulkScoringQuery.testBulkScoringIsDisabled -Dtests.seed=BDD18A3ADD885193 -Dtests.locale=ii-CN -Dtests.timezone=Etc/Zulu
junit.framework.AssertionFailedError: Expected exception AssertionError but no exception was thrown
    at org.apache.lucene.monitor.TestForceNoBulkScoringQuery.testBulkScoringIsDisabled(TestForceNoBulkScoringQuery.java:105)

The sanity check added in #16350 assumes that searching the un-wrapped ThrowsOnBulkScoreQuery always reaches its ScorerSupplier#bulkScorer(). But newSearcher(reader) may wrap the searcher with AssertingIndexSearcher, whose scorer supplier deliberately builds the bulk scorer from scorer() instead of delegating (the usually(random) branch in AssertingWeight — ~1% of seeds in normal runs, more under nightly). In that case the expected AssertionError is never thrown and the sanity check fails before the actual ForceNoBulkScoringQuery behavior is exercised.

Since the scorer/bulkScorer dispatch is exactly what this test asserts on, use a plain IndexSearcher so the dispatch is deterministic. The failing seed above passes with this change (and the sanity check still fires, i.e. the plain searcher does reach bulkScorer()).

First hit on an unrelated PR's CI (#16368). Happy to restructure — e.g. keep the randomized searcher for the wrapped-query assertion only — if you'd prefer.

The sanity check added in apache#16350 assumes that searching the un-wrapped
ThrowsOnBulkScoreQuery always calls ScorerSupplier#bulkScorer. With
newSearcher(reader) the searcher may be an AssertingIndexSearcher,
whose ScorerSupplier sometimes builds the bulk scorer from scorer()
instead of delegating, so the expected AssertionError is never thrown:

  gradlew -p lucene/monitor test --tests TestForceNoBulkScoringQuery \
    -Dtests.seed=BDD18A3ADD885193

Use a plain IndexSearcher so the dispatch under test is deterministic.
@dweiss dweiss added this to the 11.0.0 milestone Jul 7, 2026
@dweiss dweiss merged commit 062c530 into apache:main Jul 7, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants