LUCENE-10278: don't write zero-sized array in this test (#501)

DocIdsWriter is not prepared for this.
This commit is contained in:
Robert Muir 2021-12-02 09:53:09 -05:00 committed by GitHub
parent 3d61ff2cf6
commit 77563c2c15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -35,7 +35,7 @@ public class TestDocIdsWriter extends LuceneTestCase {
int numIters = atLeast(100); int numIters = atLeast(100);
try (Directory dir = newDirectory()) { try (Directory dir = newDirectory()) {
for (int iter = 0; iter < numIters; ++iter) { for (int iter = 0; iter < numIters; ++iter) {
int[] docIDs = new int[random().nextInt(5000)]; int[] docIDs = new int[1 + random().nextInt(5000)];
final int bpv = TestUtil.nextInt(random(), 1, 32); final int bpv = TestUtil.nextInt(random(), 1, 32);
for (int i = 0; i < docIDs.length; ++i) { for (int i = 0; i < docIDs.length; ++i) {
docIDs[i] = TestUtil.nextInt(random(), 0, (1 << bpv) - 1); docIDs[i] = TestUtil.nextInt(random(), 0, (1 << bpv) - 1);
@ -49,7 +49,7 @@ public class TestDocIdsWriter extends LuceneTestCase {
int numIters = atLeast(100); int numIters = atLeast(100);
try (Directory dir = newDirectory()) { try (Directory dir = newDirectory()) {
for (int iter = 0; iter < numIters; ++iter) { for (int iter = 0; iter < numIters; ++iter) {
int[] docIDs = new int[random().nextInt(5000)]; int[] docIDs = new int[1 + random().nextInt(5000)];
final int bpv = TestUtil.nextInt(random(), 1, 32); final int bpv = TestUtil.nextInt(random(), 1, 32);
for (int i = 0; i < docIDs.length; ++i) { for (int i = 0; i < docIDs.length; ++i) {
docIDs[i] = TestUtil.nextInt(random(), 0, (1 << bpv) - 1); docIDs[i] = TestUtil.nextInt(random(), 0, (1 << bpv) - 1);
@ -64,7 +64,7 @@ public class TestDocIdsWriter extends LuceneTestCase {
int numIters = atLeast(100); int numIters = atLeast(100);
try (Directory dir = newDirectory()) { try (Directory dir = newDirectory()) {
for (int iter = 0; iter < numIters; ++iter) { for (int iter = 0; iter < numIters; ++iter) {
int size = random().nextInt(5000); int size = 1 + random().nextInt(5000);
Set<Integer> set = new HashSet<>(size); Set<Integer> set = new HashSet<>(size);
int small = random().nextInt(1000); int small = random().nextInt(1000);
while (set.size() < size) { while (set.size() < size) {