Browse Source

Fix global checkpoint listeners test

This commit fixes a global checkpoint listeners test wherein we were
expecting an executor to have been used even if there were no
listeners. This is silliness, so this commit adjusts the assertion to
verify that the executor never fires if there are no listeners, and
fires exactly once if there is one or more listeners.
Jason Tedor 7 years ago
parent
commit
364ccc36d6

+ 1 - 1
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 {