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.
This commit is contained in:
Boaz Leskes 2017-07-26 13:28:39 +02:00
parent 91dc1c5da6
commit 015424d9f4
1 changed files with 1 additions and 1 deletions

View File

@ -2170,7 +2170,7 @@ public class IndexShardTests extends IndexShardTestCase {
int max = offset; int max = offset;
boolean gap = false; boolean gap = false;
for (int i = offset + 1; i < operations; i++) { 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); final String id = Integer.toString(i);
SourceToParse sourceToParse = SourceToParse.source(indexShard.shardId().getIndexName(), "test", id, SourceToParse sourceToParse = SourceToParse.source(indexShard.shardId().getIndexName(), "test", id,
new BytesArray("{}"), XContentType.JSON); new BytesArray("{}"), XContentType.JSON);