Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky QueryProfilePhaseTests.testTerminateAfterEarlyTermination #11683

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -615,12 +615,22 @@ public void testTerminateAfterEarlyTermination() throws Exception {
assertThat(query.getTimeBreakdown().get("score"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("score_count"), greaterThan(0L));
if (executor != null) {
assertThat(query.getTimeBreakdown().get("max_score"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("min_score"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("avg_score"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("max_score_count"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("min_score_count"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("avg_score_count"), greaterThan(0L));
long maxScore = query.getTimeBreakdown().get("max_score");
long minScore = query.getTimeBreakdown().get("min_score");
long avgScore = query.getTimeBreakdown().get("avg_score");
long maxScoreCount = query.getTimeBreakdown().get("max_score_count");
long minScoreCount = query.getTimeBreakdown().get("min_score_count");
long avgScoreCount = query.getTimeBreakdown().get("avg_score_count");
assertThat(maxScore, greaterThan(0L));
assertThat(minScore, greaterThanOrEqualTo(0L));
sohami marked this conversation as resolved.
Show resolved Hide resolved
assertThat(avgScore, greaterThanOrEqualTo(0L));
assertThat(maxScore, greaterThanOrEqualTo(avgScore));
assertThat(avgScore, greaterThanOrEqualTo(minScore));
assertThat(maxScoreCount, greaterThan(0L));
assertThat(minScoreCount, greaterThanOrEqualTo(0L));
assertThat(avgScoreCount, greaterThanOrEqualTo(0L));
assertThat(maxScoreCount, greaterThanOrEqualTo(avgScoreCount));
assertThat(avgScoreCount, greaterThanOrEqualTo(minScoreCount));
}
assertThat(query.getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("create_weight_count"), equalTo(1L));
Expand Down Expand Up @@ -744,30 +754,50 @@ public void testTerminateAfterEarlyTermination() throws Exception {
assertThat(query.getProfiledChildren().get(0).getTime(), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("score"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("score_count"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("score"), greaterThanOrEqualTo(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("score_count"), greaterThanOrEqualTo(0L));
if (executor != null) {
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("max_score"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("min_score"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("avg_score"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("max_score_count"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("min_score_count"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("avg_score_count"), greaterThan(0L));
long maxScore = query.getProfiledChildren().get(0).getTimeBreakdown().get("max_score");
long minScore = query.getProfiledChildren().get(0).getTimeBreakdown().get("min_score");
long avgScore = query.getProfiledChildren().get(0).getTimeBreakdown().get("avg_score");
long maxScoreCount = query.getProfiledChildren().get(0).getTimeBreakdown().get("max_score_count");
long minScoreCount = query.getProfiledChildren().get(0).getTimeBreakdown().get("min_score_count");
long avgScoreCount = query.getProfiledChildren().get(0).getTimeBreakdown().get("avg_score_count");
assertThat(maxScore, greaterThanOrEqualTo(0L));
assertThat(minScore, greaterThanOrEqualTo(0L));
assertThat(avgScore, greaterThanOrEqualTo(0L));
assertThat(maxScore, greaterThanOrEqualTo(avgScore));
assertThat(avgScore, greaterThanOrEqualTo(minScore));
assertThat(maxScoreCount, greaterThanOrEqualTo(0L));
assertThat(minScoreCount, greaterThanOrEqualTo(0L));
assertThat(avgScoreCount, greaterThanOrEqualTo(0L));
assertThat(maxScoreCount, greaterThanOrEqualTo(avgScoreCount));
assertThat(avgScoreCount, greaterThanOrEqualTo(minScoreCount));
}

assertThat(query.getProfiledChildren().get(1).getQueryName(), equalTo("TermQuery"));
assertThat(query.getProfiledChildren().get(1).getTime(), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("score"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("score_count"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("score"), greaterThanOrEqualTo(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("score_count"), greaterThanOrEqualTo(0L));
if (executor != null) {
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("max_score"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("min_score"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("avg_score"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("max_score_count"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("min_score_count"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("avg_score_count"), greaterThan(0L));
long maxScore = query.getProfiledChildren().get(1).getTimeBreakdown().get("max_score");
long minScore = query.getProfiledChildren().get(1).getTimeBreakdown().get("min_score");
long avgScore = query.getProfiledChildren().get(1).getTimeBreakdown().get("avg_score");
long maxScoreCount = query.getProfiledChildren().get(1).getTimeBreakdown().get("max_score_count");
long minScoreCount = query.getProfiledChildren().get(1).getTimeBreakdown().get("min_score_count");
long avgScoreCount = query.getProfiledChildren().get(1).getTimeBreakdown().get("avg_score_count");
assertThat(maxScore, greaterThanOrEqualTo(0L));
assertThat(minScore, greaterThanOrEqualTo(0L));
assertThat(avgScore, greaterThanOrEqualTo(0L));
assertThat(maxScore, greaterThanOrEqualTo(avgScore));
assertThat(avgScore, greaterThanOrEqualTo(minScore));
assertThat(maxScoreCount, greaterThanOrEqualTo(0L));
assertThat(minScoreCount, greaterThanOrEqualTo(0L));
assertThat(avgScoreCount, greaterThanOrEqualTo(0L));
assertThat(maxScoreCount, greaterThanOrEqualTo(avgScoreCount));
assertThat(avgScoreCount, greaterThanOrEqualTo(minScoreCount));
}
}, collector -> {
assertThat(collector.getReason(), equalTo("search_terminate_after_count"));
Expand Down
Loading