diff --git a/src/test/java/org/elasticsearch/percolator/TTLPercolatorTests.java b/src/test/java/org/elasticsearch/percolator/TTLPercolatorTests.java index 2cfd711787f..af800643e8f 100644 --- a/src/test/java/org/elasticsearch/percolator/TTLPercolatorTests.java +++ b/src/test/java/org/elasticsearch/percolator/TTLPercolatorTests.java @@ -51,6 +51,10 @@ public class TTLPercolatorTests extends ElasticsearchIntegrationTest { private static final long PURGE_INTERVAL = 200; + @Override + protected void beforeIndexDeletion() { + } + @Override protected Settings nodeSettings(int nodeOrdinal) { return settingsBuilder() diff --git a/src/test/java/org/elasticsearch/river/RiverTests.java b/src/test/java/org/elasticsearch/river/RiverTests.java index 6587ca84c72..1a3e0e70168 100644 --- a/src/test/java/org/elasticsearch/river/RiverTests.java +++ b/src/test/java/org/elasticsearch/river/RiverTests.java @@ -43,6 +43,10 @@ import static org.hamcrest.Matchers.equalTo; @AwaitsFix(bugUrl="occasionally fails apparently due to synchronous mappings updates") public class RiverTests extends ElasticsearchIntegrationTest { + @Override + protected void beforeIndexDeletion() { + } + @Test public void testRiverStart() throws Exception { startAndCheckRiverIsStarted("dummy-river-test"); diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java index 6c6e9138596..a85092473f0 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java @@ -642,7 +642,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase } ensureClusterSizeConsistency(); ensureClusterStateConsistency(); - cluster().beforeIndexDeletion(); + beforeIndexDeletion(); cluster().wipe(); // wipe after to make sure we fail in the test that didn't ack the delete if (afterClass || currentClusterScope == Scope.TEST) { cluster().close(); @@ -665,6 +665,10 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase } } + protected void beforeIndexDeletion() { + cluster().beforeIndexDeletion(); + } + public static TestCluster cluster() { return currentCluster; } diff --git a/src/test/java/org/elasticsearch/test/InternalTestCluster.java b/src/test/java/org/elasticsearch/test/InternalTestCluster.java index 9c3296f635b..1ce5b7e3066 100644 --- a/src/test/java/org/elasticsearch/test/InternalTestCluster.java +++ b/src/test/java/org/elasticsearch/test/InternalTestCluster.java @@ -971,6 +971,11 @@ public final class InternalTestCluster extends TestCluster { @Override public void beforeIndexDeletion() { + // Check that the operations counter on index shard has reached 1. + // The assumption here is that after a test there are no ongoing write operations. + // test that have ongoing write operations after the test (for example because ttl is used + // and not all docs have been purged after the test) and inherit from + // ElasticsearchIntegrationTest must override beforeIndexDeletion() to avoid failures. assertShardIndexCounter(); }