[Tests] Relax assertion in SuggestStatsIT (#28544)

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
This commit is contained in:
Christoph Büscher 2018-02-07 17:26:08 +01:00 committed by GitHub
parent 305b87b4b7
commit c0886cf7c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -112,7 +112,7 @@ public class SuggestStatsIT extends ESIntegTestCase {
logger.info("iter {}, iter1 {}, iter2 {}, {}", suggestAllIdx, suggestIdx1, suggestIdx2, endTime - startTime); logger.info("iter {}, iter1 {}, iter2 {}, {}", suggestAllIdx, suggestIdx1, suggestIdx2, endTime - startTime);
// check suggest time // 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 // the upperbound is num shards * total time since we do searches in parallel
assertThat(suggest.getSuggestTimeInMillis(), lessThanOrEqualTo(totalShards * (endTime - startTime))); assertThat(suggest.getSuggestTimeInMillis(), lessThanOrEqualTo(totalShards * (endTime - startTime)));
@ -124,7 +124,7 @@ public class SuggestStatsIT extends ESIntegTestCase {
logger.info("evaluating {}", stat.getNode()); logger.info("evaluating {}", stat.getNode());
if (nodeIdsWithIndex.contains(stat.getNode().getId())) { if (nodeIdsWithIndex.contains(stat.getNode().getId())) {
assertThat(suggestStats.getSuggestCount(), greaterThan(0L)); assertThat(suggestStats.getSuggestCount(), greaterThan(0L));
assertThat(suggestStats.getSuggestTimeInMillis(), greaterThan(0L)); assertThat(suggestStats.getSuggestTimeInMillis(), greaterThanOrEqualTo(0L));
num++; num++;
} else { } else {
assertThat(suggestStats.getSuggestCount(), equalTo(0L)); assertThat(suggestStats.getSuggestCount(), equalTo(0L));