Fix janky test
Fixes a test that incorrectly assumed that a list of random values less than or equal to `n` always contained `n`. Oops. Closes #58353
This commit is contained in:
parent
71adade73a
commit
c7726cc93e
|
@ -104,7 +104,6 @@ public class LongKeyedBucketOrdsTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/58353")
|
||||
public void testCollectsFromManyBuckets() {
|
||||
try (LongKeyedBucketOrds ords = LongKeyedBucketOrds.build(bigArrays, false)) {
|
||||
// Test a few explicit values
|
||||
|
@ -121,11 +120,13 @@ public class LongKeyedBucketOrdsTests extends ESTestCase {
|
|||
seen.add(new OwningBucketOrdAndValue(0, 0));
|
||||
seen.add(new OwningBucketOrdAndValue(1, 0));
|
||||
OwningBucketOrdAndValue[] values = new OwningBucketOrdAndValue[scaledRandomIntBetween(1, 10000)];
|
||||
long maxOwningBucketOrd = scaledRandomIntBetween(0, values.length);
|
||||
long maxAllowedOwningBucketOrd = scaledRandomIntBetween(0, values.length);
|
||||
long maxOwningBucketOrd = Long.MIN_VALUE;
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
values[i] = randomValueOtherThanMany(seen::contains, () ->
|
||||
new OwningBucketOrdAndValue(randomLongBetween(0, maxOwningBucketOrd), randomLong()));
|
||||
new OwningBucketOrdAndValue(randomLongBetween(0, maxAllowedOwningBucketOrd), randomLong()));
|
||||
seen.add(values[i]);
|
||||
maxOwningBucketOrd = Math.max(maxOwningBucketOrd, values[i].owningBucketOrd);
|
||||
}
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
assertThat(ords.find(values[i].owningBucketOrd, values[i].value), equalTo(-1L));
|
||||
|
@ -145,7 +146,7 @@ public class LongKeyedBucketOrdsTests extends ESTestCase {
|
|||
assertThat(ords.add(1, 0), equalTo(-2L));
|
||||
|
||||
|
||||
for (long owningBucketOrd = 0; owningBucketOrd <= maxOwningBucketOrd; owningBucketOrd++) {
|
||||
for (long owningBucketOrd = 0; owningBucketOrd <= maxAllowedOwningBucketOrd; owningBucketOrd++) {
|
||||
long expectedCount = 0;
|
||||
LongKeyedBucketOrds.BucketOrdsEnum ordsEnum = ords.ordsEnum(owningBucketOrd);
|
||||
if (owningBucketOrd <= 1) {
|
||||
|
|
Loading…
Reference in New Issue