Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ public void testMixedValidationResults() {
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());
}
Expand All @@ -138,7 +140,10 @@ public void testIgnoreReadWhenValidating() {
assertNull("content should not pass yet, need explicit read", channel.readInbound());

channel.read();
assertTrue(channel.readInbound() instanceof LastHttpContent);
var lastContent = channel.readInbound();
assertTrue(lastContent instanceof LastHttpContent);
((LastHttpContent) lastContent).release();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or, in one line (with slightly nicer failure message too):

Suggested change
var lastContent = channel.readInbound();
assertTrue(lastContent instanceof LastHttpContent);
((LastHttpContent) lastContent).release();
asInstanceOf(LastHttpContent.class, channel.readInbound()).release();

}

public void testWithFlowControlAndAggregator() {
Expand All @@ -157,9 +162,10 @@ public void testWithFlowControlAndAggregator() {
validationRequest.listener.onResponse(null);
channel.runPendingTasks();

assertTrue(channel.readInbound() instanceof FullHttpRequest);
var fullReq = channel.readInbound();
assertTrue(fullReq instanceof FullHttpRequest);
((FullHttpRequest) fullReq).release();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise

Suggested change
var fullReq = channel.readInbound();
assertTrue(fullReq instanceof FullHttpRequest);
((FullHttpRequest) fullReq).release();
asInstanceOf(FullHttpRequest.class, channel.readInbound()).release();

}

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

}