Prevent page-tracking checks from spreading across tests.
This commit is contained in:
parent
7af63700c9
commit
5723603987
|
@ -35,12 +35,15 @@ public class MockPageCacheRecycler extends PageCacheRecycler {
|
|||
|
||||
private static final ConcurrentMap<Object, Throwable> ACQUIRED_PAGES = Maps.newConcurrentMap();
|
||||
|
||||
public static void reset() {
|
||||
ACQUIRED_PAGES.clear();
|
||||
}
|
||||
|
||||
public static void ensureAllPagesAreReleased() {
|
||||
if (ACQUIRED_PAGES.size() > 0) {
|
||||
final Throwable t = ACQUIRED_PAGES.entrySet().iterator().next().getValue();
|
||||
throw new RuntimeException(ACQUIRED_PAGES.size() + " pages have not been released", t);
|
||||
}
|
||||
ACQUIRED_PAGES.clear();
|
||||
}
|
||||
|
||||
private final Random random;
|
||||
|
|
|
@ -122,6 +122,11 @@ public abstract class ElasticsearchTestCase extends AbstractRandomizedTest {
|
|||
return new File(uri);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void resetPageTracking() {
|
||||
MockPageCacheRecycler.reset();
|
||||
}
|
||||
|
||||
@After
|
||||
public void ensureAllPagesReleased() {
|
||||
MockPageCacheRecycler.ensureAllPagesAreReleased();
|
||||
|
|
Loading…
Reference in New Issue