Skip to content

Commit d955c76

Browse files
committed
more test fixes
1 parent 0c8d2cf commit d955c76

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/src/test/java/org/elasticsearch/search/query/QueryPhaseTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,12 +568,13 @@ public void testTerminateAfterWithHitsNoHitCountShortcut() throws Exception {
568568
// size is lower than terminate_after
569569
context.setSize(5);
570570
// track_total_hits is lower than terminate_after
571-
context.trackTotalHitsUpTo(randomIntBetween(1, 6));
571+
int trackTotalHits = randomIntBetween(1, 6);
572+
context.trackTotalHitsUpTo(trackTotalHits);
572573
QueryPhase.executeQuery(context);
573574
// depending on docs distribution we may or may not be able to honor terminate_after: low scoring hits are skipped via
574575
// setMinCompetitiveScore, which bypasses terminate_after until the next leaf collector is pulled, when that happens.
575576
assertThat(context.queryResult().terminatedEarly(), either(is(true)).or(is(false)));
576-
assertThat(context.queryResult().topDocs().topDocs.totalHits.value(), equalTo(7L));
577+
assertThat(context.queryResult().topDocs().topDocs.totalHits.value(), greaterThanOrEqualTo((long) trackTotalHits));
577578
assertThat(context.queryResult().topDocs().topDocs.totalHits.relation(), equalTo(TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO));
578579
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(5));
579580
}

0 commit comments

Comments
 (0)