Skip to content

Commit

Permalink
Fix flaky testMinScoreDisablesCountOptimization in query profile phas…
Browse files Browse the repository at this point in the history
…e tests (opensearch-project#11104)

Signed-off-by: Ticheng Lin <[email protected]>
  • Loading branch information
ticheng-aws committed Nov 6, 2023
1 parent c1962cc commit b755403
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,17 @@ public void testMinScoreDisablesCountOptimization() throws Exception {
assertEquals(TotalHits.Relation.EQUAL_TO, context.queryResult().topDocs().topDocs.totalHits.relation);
assertProfileData(context, "MatchAllDocsQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), greaterThanOrEqualTo(100L));
assertThat(query.getTimeBreakdown().get("score"), greaterThanOrEqualTo(1L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(1L));
if (executor != null) {
assertThat(query.getTimeBreakdown().get("max_score"), greaterThanOrEqualTo(100L));
assertThat(query.getTimeBreakdown().get("min_score"), greaterThanOrEqualTo(100L));
assertThat(query.getTimeBreakdown().get("avg_score"), greaterThanOrEqualTo(100L));
long maxScore = query.getTimeBreakdown().get("max_score");
long minScore = query.getTimeBreakdown().get("min_score");
long avgScore = query.getTimeBreakdown().get("avg_score");
assertThat(maxScore, greaterThanOrEqualTo(1L));
assertThat(minScore, greaterThanOrEqualTo(1L));
assertThat(avgScore, greaterThanOrEqualTo(1L));
assertThat(maxScore, greaterThanOrEqualTo(avgScore));
assertThat(avgScore, greaterThanOrEqualTo(minScore));
assertThat(query.getTimeBreakdown().get("max_score_count"), equalTo(1L));
assertThat(query.getTimeBreakdown().get("min_score_count"), equalTo(1L));
assertThat(query.getTimeBreakdown().get("avg_score_count"), equalTo(1L));
Expand Down

0 comments on commit b755403

Please sign in to comment.