From 185248651b0d7eec460a1fb913ced9818b611feb Mon Sep 17 00:00:00 2001 From: Andrei Dan Date: Thu, 4 Mar 2021 12:04:53 +0000 Subject: [PATCH] Fix IndexStats.testBulkStats This makes the assertions that look at time averages more lenient. The operation duration is measured in nanos and then converted to millis, so we'll allow for a 0 reading for these averages. --- .../org/elasticsearch/indices/stats/IndexStatsIT.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/internalClusterTest/java/org/elasticsearch/indices/stats/IndexStatsIT.java b/server/src/internalClusterTest/java/org/elasticsearch/indices/stats/IndexStatsIT.java index 2eb44e308c2fc..b7c85f815d925 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/indices/stats/IndexStatsIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/indices/stats/IndexStatsIT.java @@ -85,6 +85,7 @@ import static org.hamcrest.Matchers.emptyCollectionOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.notNullValue; @@ -1066,7 +1067,6 @@ public void testFilterCacheStats() throws Exception { assertThat(response.getTotal().queryCache.getMemorySizeInBytes(), equalTo(0L)); } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/55485") public void testBulkStats() throws Exception { final String index = "test"; assertAcked(prepareCreate(index).setSettings(settingsBuilder().put("index.number_of_shards", 2) @@ -1086,15 +1086,15 @@ public void testBulkStats() throws Exception { IndicesStatsResponse stats = client().admin().indices().prepareStats(index).setBulk(true).get(); assertThat(stats.getTotal().bulk.getTotalOperations(), equalTo(4L)); - assertThat(stats.getTotal().bulk.getTotalTimeInMillis(), greaterThan(0L)); + assertThat(stats.getTotal().bulk.getTotalTimeInMillis(), greaterThanOrEqualTo(0L)); assertThat(stats.getTotal().bulk.getTotalSizeInBytes(), greaterThan(0L)); - assertThat(stats.getTotal().bulk.getAvgTimeInMillis(), greaterThan(0L)); + assertThat(stats.getTotal().bulk.getAvgTimeInMillis(), greaterThanOrEqualTo(0L)); assertThat(stats.getTotal().bulk.getAvgSizeInBytes(), greaterThan(0L)); assertThat(stats.getPrimaries().bulk.getTotalOperations(), equalTo(2L)); - assertThat(stats.getPrimaries().bulk.getTotalTimeInMillis(), greaterThan(0L)); + assertThat(stats.getPrimaries().bulk.getTotalTimeInMillis(), greaterThanOrEqualTo(0L)); assertThat(stats.getPrimaries().bulk.getTotalSizeInBytes(), greaterThan(0L)); - assertThat(stats.getPrimaries().bulk.getAvgTimeInMillis(), greaterThan(0L)); + assertThat(stats.getPrimaries().bulk.getAvgTimeInMillis(), greaterThanOrEqualTo(0L)); assertThat(stats.getPrimaries().bulk.getAvgSizeInBytes(), greaterThan(0L)); }