diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java index e855636af15a1..aa25134a42988 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java @@ -1947,19 +1947,19 @@ public final void cleanUpCluster() throws Exception { @AfterClass public static void afterClass() throws Exception { - if (!runTestScopeLifecycle()) { - try { + try { + if (runTestScopeLifecycle()) { + clearClusters(); + } else { INSTANCE.printTestMessage("cleaning up after"); INSTANCE.afterInternal(true); checkStaticState(true); - } finally { - INSTANCE = null; } - } else { - clearClusters(); + } finally { + SUITE_SEED = null; + currentCluster = null; + INSTANCE = null; } - SUITE_SEED = null; - currentCluster = null; } private static void initializeSuiteScope() throws Exception {