Release buffers in netty test (#126744)

This commit is contained in:
Mikhail Berezovskiy 2025-04-14 13:09:12 -07:00 committed by GitHub
parent b47bd3adc7
commit f9f3defe92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -111,7 +111,9 @@ public class Netty4HttpHeaderValidatorTests extends ESTestCase {
channel.writeInbound(last);
if (shouldPassValidation) {
assertEquals("should pass content for valid request", content, channel.readInbound());
content.release();
assertEquals(last, channel.readInbound());
last.release();
} else {
assertNull("should drop content for invalid request", channel.readInbound());
}
@ -138,7 +140,7 @@ public class Netty4HttpHeaderValidatorTests extends ESTestCase {
assertNull("content should not pass yet, need explicit read", channel.readInbound());
channel.read();
assertTrue(channel.readInbound() instanceof LastHttpContent);
asInstanceOf(LastHttpContent.class, channel.readInbound()).release();
}
public void testWithFlowControlAndAggregator() {
@ -157,9 +159,8 @@ public class Netty4HttpHeaderValidatorTests extends ESTestCase {
validationRequest.listener.onResponse(null);
channel.runPendingTasks();
assertTrue(channel.readInbound() instanceof FullHttpRequest);
asInstanceOf(FullHttpRequest.class, channel.readInbound()).release();
}
record ValidationRequest(HttpRequest request, Channel channel, ActionListener<Void> listener) {}
}