Skip to content

Commit f9f3def

Browse files
authored
Release buffers in netty test (#126744)
1 parent b47bd3a commit f9f3def

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 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,7 @@ 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+
asInstanceOf(LastHttpContent.class, channel.readInbound()).release();
142144
}
143145

144146
public void testWithFlowControlAndAggregator() {
@@ -157,9 +159,8 @@ public void testWithFlowControlAndAggregator() {
157159
validationRequest.listener.onResponse(null);
158160
channel.runPendingTasks();
159161

160-
assertTrue(channel.readInbound() instanceof FullHttpRequest);
162+
asInstanceOf(FullHttpRequest.class, channel.readInbound()).release();
161163
}
162164

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

0 commit comments

Comments
 (0)