From 1e0506b6a0b85dbe8a98a73f27d37ff3a1828907 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 4 Jul 2014 14:58:08 +0200 Subject: [PATCH] [TEST] Reset all cluster if a test hit a failure Closes #6734 --- .../org/elasticsearch/test/ElasticsearchIntegrationTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java index dbccb5b7bcb..21ef3e1614f 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java @@ -543,16 +543,19 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase } throw e; } finally { - if (!success) { + if (!success || suiteFailureMarker.hadFailures()) { // if we failed that means that something broke horribly so we should // clear all clusters and if the current cluster is the global we shut that one // down as well to prevent subsequent tests from failing due to the same problem. + // we also reset everything in the case we had a failure in the suite to make sure subsequent + // tests get a new / clean cluster clearClusters(); if (currentCluster == GLOBAL_CLUSTER) { GLOBAL_CLUSTER.close(); GLOBAL_CLUSTER = null; initializeGlobalCluster(); // re-init that cluster } + currentCluster = null; } if (currentCluster != null) { // this can be null if the test fails due to static initialization ie. missing parameter on the cmd