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) (opensearch-project#11104)

Signed-off-by: Ticheng Lin <[email protected]>
Signed-off-by: Shivansh Arora <[email protected]>
  • Loading branch information
ticheng-aws authored and shiv0408 committed Apr 25, 2024
1 parent cddec22 commit a521ee4
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 a521ee4

Please sign in to comment.