Skip to content

Commit 8e373f4

Browse files
committed
release buffers in netty test
1 parent ae33eaa commit 8e373f4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpHeaderValidatorTests.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ public void testMixedValidationResults() {
111111
channel.writeInbound(last);
112112
if (shouldPassValidation) {
113113
assertEquals("should pass content for valid request", content, channel.readInbound());
114+
content.release();
114115
assertEquals(last, channel.readInbound());
116+
last.release();
115117
} else {
116118
assertNull("should drop content for invalid request", channel.readInbound());
117119
}
@@ -138,7 +140,10 @@ public void testIgnoreReadWhenValidating() {
138140
assertNull("content should not pass yet, need explicit read", channel.readInbound());
139141

140142
channel.read();
141-
assertTrue(channel.readInbound() instanceof LastHttpContent);
143+
var lastContent = channel.readInbound();
144+
assertTrue(lastContent instanceof LastHttpContent);
145+
((LastHttpContent) lastContent).release();
146+
142147
}
143148

144149
public void testWithFlowControlAndAggregator() {
@@ -157,9 +162,10 @@ public void testWithFlowControlAndAggregator() {
157162
validationRequest.listener.onResponse(null);
158163
channel.runPendingTasks();
159164

160-
assertTrue(channel.readInbound() instanceof FullHttpRequest);
165+
var fullReq = channel.readInbound();
166+
assertTrue(fullReq instanceof FullHttpRequest);
167+
((FullHttpRequest) fullReq).release();
161168
}
162169

163170
record ValidationRequest(HttpRequest request, Channel channel, ActionListener<Void> listener) {}
164-
165171
}

0 commit comments

Comments
 (0)