[TEST] don't check shard counter if there are still write operations ongoing after test

This commit is contained in:
Britta Weber 2015-05-06 18:23:26 +02:00
parent 234716a1ef
commit 790318c65a
4 changed files with 18 additions and 1 deletions

View File

@ -51,6 +51,10 @@ public class TTLPercolatorTests extends ElasticsearchIntegrationTest {
private static final long PURGE_INTERVAL = 200; private static final long PURGE_INTERVAL = 200;
@Override
protected void beforeIndexDeletion() {
}
@Override @Override
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
return settingsBuilder() return settingsBuilder()

View File

@ -43,6 +43,10 @@ import static org.hamcrest.Matchers.equalTo;
@AwaitsFix(bugUrl="occasionally fails apparently due to synchronous mappings updates") @AwaitsFix(bugUrl="occasionally fails apparently due to synchronous mappings updates")
public class RiverTests extends ElasticsearchIntegrationTest { public class RiverTests extends ElasticsearchIntegrationTest {
@Override
protected void beforeIndexDeletion() {
}
@Test @Test
public void testRiverStart() throws Exception { public void testRiverStart() throws Exception {
startAndCheckRiverIsStarted("dummy-river-test"); startAndCheckRiverIsStarted("dummy-river-test");

View File

@ -642,7 +642,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
} }
ensureClusterSizeConsistency(); ensureClusterSizeConsistency();
ensureClusterStateConsistency(); ensureClusterStateConsistency();
cluster().beforeIndexDeletion(); beforeIndexDeletion();
cluster().wipe(); // wipe after to make sure we fail in the test that didn't ack the delete cluster().wipe(); // wipe after to make sure we fail in the test that didn't ack the delete
if (afterClass || currentClusterScope == Scope.TEST) { if (afterClass || currentClusterScope == Scope.TEST) {
cluster().close(); cluster().close();
@ -665,6 +665,10 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
} }
} }
protected void beforeIndexDeletion() {
cluster().beforeIndexDeletion();
}
public static TestCluster cluster() { public static TestCluster cluster() {
return currentCluster; return currentCluster;
} }

View File

@ -971,6 +971,11 @@ public final class InternalTestCluster extends TestCluster {
@Override @Override
public void beforeIndexDeletion() { 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(); assertShardIndexCounter();
} }