Skip to content

Commit

Permalink
fix: fix flaky test
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Han <[email protected]>
  • Loading branch information
superhx committed Apr 16, 2024
1 parent 18ea032 commit a450fb4
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,12 @@ public void testRead_withReadahead() throws ExecutionException, InterruptedExcep
// - load more index
// - readahead from offset = 14...22
verify(dataBlockCache, timeout(1000).times(14 + 9 + 8)).getBlock(any(), any());
assertEquals(34L, streamReader.loadedBlockIndexEndOffset);
assertEquals(14L + 8, streamReader.readahead.nextReadaheadOffset);
assertEquals(14L, streamReader.readahead.readaheadMarkOffset);
assertEquals(1024L * 1024 * 2, streamReader.readahead.nextReadaheadSize);
eventLoops[0].submit(() -> {
assertEquals(34L, streamReader.loadedBlockIndexEndOffset);
assertEquals(14L + 8, streamReader.readahead.nextReadaheadOffset);
assertEquals(14L, streamReader.readahead.readaheadMarkOffset);
assertEquals(1024L * 1024 * 2, streamReader.readahead.nextReadaheadSize);
}).get();


when(objectManager.isObjectExist(anyLong())).thenReturn(false);
Expand All @@ -207,7 +209,6 @@ public void testRead_withReadahead() throws ExecutionException, InterruptedExcep
}
}).when(objectManager).isObjectExist(anyLong());
eventLoops[0].submit(() -> readCf.set(streamReader.read(14L, 15L, Integer.MAX_VALUE))).get();
rst = readCf.get().get(1, TimeUnit.SECONDS);

}

Expand Down

0 comments on commit a450fb4

Please sign in to comment.