diff --git a/server/src/test/java/org/elasticsearch/index/shard/GlobalCheckpointListenersTests.java b/server/src/test/java/org/elasticsearch/index/shard/GlobalCheckpointListenersTests.java index d9240602d85..43b16c6ecc7 100644 --- a/server/src/test/java/org/elasticsearch/index/shard/GlobalCheckpointListenersTests.java +++ b/server/src/test/java/org/elasticsearch/index/shard/GlobalCheckpointListenersTests.java @@ -341,7 +341,7 @@ public class GlobalCheckpointListenersTests extends ESTestCase { globalCheckpointListeners.add(NO_OPS_PERFORMED, (g, e) -> {}); } globalCheckpointListeners.globalCheckpointUpdated(randomLongBetween(NO_OPS_PERFORMED, Long.MAX_VALUE)); - assertThat(count.get(), equalTo(1)); + assertThat(count.get(), equalTo(numberOfListeners == 0 ? 0 : 1)); } public void testConcurrency() throws BrokenBarrierException, InterruptedException {