Skip to content

[MINOR][NETWORK][TEST] Fix TransportFrameDecoderSuite to use ByteBuf instead of ByteBuffer #23442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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 @@ -17,7 +17,6 @@

package org.apache.spark.network.util;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
Expand Down Expand Up @@ -69,7 +68,7 @@ public void testInterception() throws Exception {
decoder.channelRead(ctx, len);
decoder.channelRead(ctx, dataBuf);
verify(interceptor, times(interceptedReads)).handle(any(ByteBuf.class));
verify(ctx).fireChannelRead(any(ByteBuffer.class));
verify(ctx).fireChannelRead(any(ByteBuf.class));
Copy link
Member Author

Choose a reason for hiding this comment

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

Hi, @vanzin .
Could you review this? The other place seems to use ByteBuf consistently.

$ git grep 'fireChannelRead(any(ByteBuf.class)'
common/network-common/src/test/java/org/apache/spark/network/util/TransportFrameDecoderSuite.java:      verify(ctx, never()).fireChannelRead(any(ByteBuf.class));
common/network-common/src/test/java/org/apache/spark/network/util/TransportFrameDecoderSuite.java:      verify(ctx).fireChannelRead(any(ByteBuf.class));
common/network-common/src/test/java/org/apache/spark/network/util/TransportFrameDecoderSuite.java:      verify(ctx, times(frameCount)).fireChannelRead(any(ByteBuf.class));

Copy link
Contributor

Choose a reason for hiding this comment

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

I was trying to figure out why this even compiled (the class doesn't really make a difference here otherwise, since it's an any matcher). The API is actually fireChannelRead(Object msg), which explains it.

Anyway, the change is fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you!

assertEquals(0, len.refCnt());
assertEquals(0, dataBuf.refCnt());
} finally {
Expand Down