Fix ut: make sure that the number of slices is bigger than 1 in the SliceBuilder tests.

This commit is contained in:
Jim Ferenczi 2016-06-08 11:51:46 +02:00
parent 762bbdbd0c
commit 712c77264d
1 changed files with 2 additions and 3 deletions

View File

@ -90,7 +90,6 @@ public class SliceBuilderTests extends ESTestCase {
private final SliceBuilder randomSliceBuilder() throws IOException { private final SliceBuilder randomSliceBuilder() throws IOException {
int max = randomIntBetween(2, MAX_SLICE); int max = randomIntBetween(2, MAX_SLICE);
if (max == 0) max++;
int id = randomInt(max - 1); int id = randomInt(max - 1);
String field = randomAsciiOfLengthBetween(5, 20); String field = randomAsciiOfLengthBetween(5, 20);
return new SliceBuilder(field, id, max); return new SliceBuilder(field, id, max);
@ -279,8 +278,8 @@ public class SliceBuilderTests extends ESTestCase {
assertThat(total, equalTo(numSlices)); assertThat(total, equalTo(numSlices));
// numShards > numSlices // numShards > numSlices
numShards = randomIntBetween(3, 100); numShards = randomIntBetween(4, 100);
numSlices = randomInt(numShards-1); numSlices = randomIntBetween(2, numShards-1);
List<Integer> targetShards = new ArrayList<>(); List<Integer> targetShards = new ArrayList<>();
for (int i = 0; i < numSlices; i++) { for (int i = 0; i < numSlices; i++) {
for (int j = 0; j < numShards; j++) { for (int j = 0; j < numShards; j++) {