[TEST] Check static test state after suite scoped cluster is shut down (#21256)
Checks on static test state are run by an @After method in ESTestCase. Suite-scoped tests in ESIntegTestCase only shut down in an @AfterClass method, which executes after the @After method in ESTestCase. The suite-scoped cluster can thus still execute actions that will violate the checks in @After without those being caught. A subsequent test executing within the same JVM will fail these checks however when @After gets called for that test. This commit adds an explicit call to check the static test state after the suite-scoped cluster has been shut down.
This commit is contained in:
parent
7276737a03
commit
6930a4846c
|
@ -1970,6 +1970,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
||||||
try {
|
try {
|
||||||
INSTANCE.printTestMessage("cleaning up after");
|
INSTANCE.printTestMessage("cleaning up after");
|
||||||
INSTANCE.afterInternal(true);
|
INSTANCE.afterInternal(true);
|
||||||
|
checkStaticState();
|
||||||
} finally {
|
} finally {
|
||||||
INSTANCE = null;
|
INSTANCE = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,6 +237,11 @@ public abstract class ESTestCase extends LuceneTestCase {
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public final void ensureCleanedUp() throws Exception {
|
public final void ensureCleanedUp() throws Exception {
|
||||||
|
checkStaticState();
|
||||||
|
}
|
||||||
|
|
||||||
|
// separate method so that this can be checked again after suite scoped cluster is shut down
|
||||||
|
protected static void checkStaticState() throws Exception {
|
||||||
MockPageCacheRecycler.ensureAllPagesAreReleased();
|
MockPageCacheRecycler.ensureAllPagesAreReleased();
|
||||||
MockBigArrays.ensureAllArraysAreReleased();
|
MockBigArrays.ensureAllArraysAreReleased();
|
||||||
// field cache should NEVER get loaded.
|
// field cache should NEVER get loaded.
|
||||||
|
|
Loading…
Reference in New Issue