From c0886cf7c6d567e33d2d612fe8b7617c7e3718ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Wed, 7 Feb 2018 17:26:08 +0100 Subject: [PATCH] [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 --- .../org/elasticsearch/index/suggest/stats/SuggestStatsIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/index/suggest/stats/SuggestStatsIT.java b/server/src/test/java/org/elasticsearch/index/suggest/stats/SuggestStatsIT.java index 25eb6df4c27..7b7e7a41783 100644 --- a/server/src/test/java/org/elasticsearch/index/suggest/stats/SuggestStatsIT.java +++ b/server/src/test/java/org/elasticsearch/index/suggest/stats/SuggestStatsIT.java @@ -112,7 +112,7 @@ public class SuggestStatsIT extends ESIntegTestCase { 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))); @@ -124,7 +124,7 @@ public class SuggestStatsIT extends ESIntegTestCase { 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));