badIndexTracker.markBadIndexForRead(path, e);
badIndexTracker.markBadIndexForRead(path, e);
badIndexTracker.markBadIndexForRead(path, e);
@Test public void updatedIndexesMakesGood() throws Exception{ tracker.markBadIndexForRead("foo", new Exception()); assertTrue(tracker.isIgnoredBadIndex("foo")); tracker.markGoodIndexes(Collections.singleton("foo")); assertFalse(tracker.isIgnoredBadIndex("foo")); }
@Test public void basics() throws Exception{ tracker.markBadIndexForRead("foo", new Exception()); assertThat(tracker.getIndexPaths(), hasItem("foo")); assertTrue(tracker.isIgnoredBadIndex("foo")); tracker.markGoodIndex("foo"); assertFalse(tracker.isIgnoredBadIndex("foo")); }
@Test public void recheckDelay() throws Exception{ tracker = new BadIndexTracker(100); tracker.setTicker(ticker); tracker.markBadIndexForRead("foo", new Exception()); ticker.addTime(50, TimeUnit.MILLISECONDS); assertTrue(tracker.isIgnoredBadIndex("foo")); ticker.addTime(30, TimeUnit.MILLISECONDS); assertTrue(tracker.isIgnoredBadIndex("foo")); //Now cross the threshold ticker.addTime(30, TimeUnit.MILLISECONDS); assertFalse(tracker.isIgnoredBadIndex("foo")); //However index is still considered bad assertThat(tracker.getIndexPaths(), hasItem("foo")); }