Skip to content

Commit

Permalink
[Tests] Relax assertion in SuggestStatsIT (#28544)
Browse files Browse the repository at this point in the history
The test expects suggest times in milliseconds that are strictly
positive. Internally they are measured in nanos, it is possible that on
really fast execution this is rounded to 0L, so this should also be an
accepted value.

Closes #28543
  • Loading branch information
Christoph Büscher committed Feb 7, 2018
1 parent e317367 commit 7299dc3
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void testSimpleStats() throws Exception {

logger.info("iter {}, iter1 {}, iter2 {}, {}", suggestAllIdx, suggestIdx1, suggestIdx2, endTime - startTime);
// check suggest time
assertThat(suggest.getSuggestTimeInMillis(), greaterThan(0L));
assertThat(suggest.getSuggestTimeInMillis(), greaterThanOrEqualTo(0L));
// the upperbound is num shards * total time since we do searches in parallel
assertThat(suggest.getSuggestTimeInMillis(), lessThanOrEqualTo(totalShards * (endTime - startTime)));

Expand All @@ -124,7 +124,7 @@ public void testSimpleStats() throws Exception {
logger.info("evaluating {}", stat.getNode());
if (nodeIdsWithIndex.contains(stat.getNode().getId())) {
assertThat(suggestStats.getSuggestCount(), greaterThan(0L));
assertThat(suggestStats.getSuggestTimeInMillis(), greaterThan(0L));
assertThat(suggestStats.getSuggestTimeInMillis(), greaterThanOrEqualTo(0L));
num++;
} else {
assertThat(suggestStats.getSuggestCount(), equalTo(0L));
Expand Down

0 comments on commit 7299dc3

Please sign in to comment.