Fix IndexShardTests.testDocStats.

This commit is contained in:
Adrien Grand 2016-12-26 20:19:11 +01:00
parent 2127db27a3
commit 3cb164b22e
1 changed files with 3 additions and 1 deletions

View File

@ -1368,7 +1368,9 @@ public class IndexShardTests extends IndexShardTestCase {
try { try {
indexShard = newStartedShard(); indexShard = newStartedShard();
final long numDocs = randomIntBetween(2, 32); // at least two documents so we have docs to delete final long numDocs = randomIntBetween(2, 32); // at least two documents so we have docs to delete
final long numDocsToDelete = randomIntBetween(1, Math.toIntExact(numDocs)); // Delete at least numDocs/10 documents otherwise the number of deleted docs will be below 10%
// and forceMerge will refuse to expunge deletes
final long numDocsToDelete = randomIntBetween((int) Math.ceil(numDocs / 10.0), Math.toIntExact(numDocs));
for (int i = 0; i < numDocs; i++) { for (int i = 0; i < numDocs; i++) {
final String id = Integer.toString(i); final String id = Integer.toString(i);
final ParsedDocument doc = final ParsedDocument doc =