Skip to content

Commit

Permalink
[TEST] Check static test state after suite scoped cluster is shut down (
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
ywelsch committed Nov 2, 2016
1 parent f3ab92c commit ce7808b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1990,6 +1990,7 @@ public static void afterClass() throws Exception {
try {
INSTANCE.printTestMessage("cleaning up after");
INSTANCE.afterInternal(true);
checkStaticState();
} finally {
INSTANCE = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ public static void restoreContentType() {

@After
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();
MockBigArrays.ensureAllArraysAreReleased();
// field cache should NEVER get loaded.
Expand Down

0 comments on commit ce7808b

Please sign in to comment.