Skip to content

Commit b80b683

Browse files
authored
Fix IndexShardTests#testFlushTimeExcludingWaiting (#108109)
It may take less than a millisecond to acquire/release a lock with no contention, and flush stats have only millisecond resolution, so we can't guarantee that flush time excluding waiting is actually less than flushTime after rounding. So, we have to relax the assertion and make it `lessThanOrEqualTo` instead of `lessThan` Fixes #107462
1 parent eea94ae commit b80b683

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@
196196
import static org.hamcrest.Matchers.in;
197197
import static org.hamcrest.Matchers.instanceOf;
198198
import static org.hamcrest.Matchers.is;
199-
import static org.hamcrest.Matchers.lessThan;
200199
import static org.hamcrest.Matchers.lessThanOrEqualTo;
201200
import static org.hamcrest.Matchers.matchesRegex;
202201
import static org.hamcrest.Matchers.not;
@@ -4033,7 +4032,6 @@ public void testFlushOnIdle() throws Exception {
40334032
closeShards(shard);
40344033
}
40354034

4036-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/107462")
40374035
public void testFlushTimeExcludingWaiting() throws Exception {
40384036
IndexShard shard = newStartedShard();
40394037
for (int i = 0; i < randomIntBetween(4, 10); i++) {
@@ -4059,9 +4057,9 @@ public void testFlushTimeExcludingWaiting() throws Exception {
40594057
greaterThan(0L)
40604058
);
40614059
assertThat(
4062-
"Flush time excluding waiting should less than flush time with waiting",
4060+
"Flush time excluding waiting should be less or equal than the flush time with waiting",
40634061
flushStats.getTotalTimeExcludingWaitingOnLockMillis(),
4064-
lessThan(flushStats.getTotalTime().millis())
4062+
lessThanOrEqualTo(flushStats.getTotalTime().millis())
40654063
);
40664064
} finally {
40674065
closeShards(shard);

0 commit comments

Comments
 (0)