From 015424d9f49b5f1b912c3a06951db146d51e7248 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Wed, 26 Jul 2017 13:28:39 +0200 Subject: [PATCH] Test: indexOnReplicaWithGaps should randomly add a gap at the end This confuses assertion because if it's the only gap, it looks like one operation less is indexed and there are no gaps at all. --- .../java/org/elasticsearch/index/shard/IndexShardTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java b/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java index 924dd3c8b97..e933fd85660 100644 --- a/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java +++ b/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java @@ -2170,7 +2170,7 @@ public class IndexShardTests extends IndexShardTestCase { int max = offset; boolean gap = false; for (int i = offset + 1; i < operations; i++) { - if (!rarely()) { + if (!rarely() || i == operations - 1) { // last operation can't be a gap as it's not a gap anymore final String id = Integer.toString(i); SourceToParse sourceToParse = SourceToParse.source(indexShard.shardId().getIndexName(), "test", id, new BytesArray("{}"), XContentType.JSON);