Skip to content

Commit 6feb418

Browse files
authored
Fix test (#100547)
This commit fixes the intermittent failure of BreakingBytesRefBuilderTests. The issue is that the test uses the BreakingBytesRefBuilder's internal BytesRef array length to determine whether to expect a circuit breaker exception or not. Where it should use the builders length (not the capacity, a.k.a the internal BytesRef array length). The test failed intermittently about one in 10-20 runs before the change. The test passes successfully 100s of thousands of times with the fix. closes #99649
1 parent 3b3168b commit 6feb418

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/BreakingBytesRefBuilderTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public void applyToOracle(BytesRefBuilder oracle) {
5151
});
5252
}
5353

54-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/99649")
5554
public void testAddBytesRef() {
5655
testAgainstOracle(() -> new TestIteration() {
5756
BytesRef ref = new BytesRef(randomAlphaOfLengthBetween(1, 100));
@@ -73,7 +72,6 @@ public void applyToOracle(BytesRefBuilder oracle) {
7372
});
7473
}
7574

76-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/99649")
7775
public void testGrow() {
7876
testAgainstOracle(() -> new TestIteration() {
7977
int length = between(1, 100);
@@ -123,7 +121,7 @@ private void testAgainstOracle(Supplier<TestIteration> iterations) {
123121
boolean willResize = builder.length() + iteration.size() >= builder.bytes().length;
124122
if (willResize) {
125123
long resizeMemoryUsage = BreakingBytesRefBuilder.SHALLOW_SIZE + ramForArray(builder.bytes().length);
126-
resizeMemoryUsage += ramForArray(ArrayUtil.oversize(builder.bytes().length + iteration.size(), Byte.BYTES));
124+
resizeMemoryUsage += ramForArray(ArrayUtil.oversize(builder.length() + iteration.size(), Byte.BYTES));
127125
if (resizeMemoryUsage > limit) {
128126
Exception e = expectThrows(CircuitBreakingException.class, () -> iteration.applyToBuilder(builder));
129127
assertThat(e.getMessage(), equalTo("over test limit"));

0 commit comments

Comments
 (0)