Skip to content

Commit

Permalink
Fix flaky tests (#4947)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoewangg authored Feb 20, 2024
1 parent c9d666c commit bbe8698
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.ServerSocketChannel;
Expand Down Expand Up @@ -59,6 +60,7 @@
import software.amazon.awssdk.core.ResponseInputStream;
import software.amazon.awssdk.core.async.AsyncResponseTransformer;
import software.amazon.awssdk.core.retry.RetryPolicy;
import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.protocolrestjson.ProtocolRestJsonAsyncClient;
import software.amazon.awssdk.services.protocolrestjson.model.StreamingOutputOperationRequest;
Expand Down Expand Up @@ -88,6 +90,7 @@ void setUpPerTest() throws Exception {
.credentialsProvider(AnonymousCredentialsProvider.create())
.endpointOverride(URI.create("http://localhost:" + server.port()))
.overrideConfiguration(o -> o.retryPolicy(RetryPolicy.none()))
.httpClientBuilder(NettyNioAsyncHttpClient.builder().putChannelOption(ChannelOption.SO_RCVBUF, 8))
.build();
}

Expand Down Expand Up @@ -138,7 +141,7 @@ void verifyConnection(Consumer<ResponseInputStream<StreamingOutputOperationRespo

private static class Server extends ChannelInitializer<Channel> {
private static final byte[] CONTENT = ("{ "
+ "\"foo\": " + RandomStringUtils.randomAscii(1024)
+ "\"foo\": " + RandomStringUtils.randomAscii(1024 * 1024 * 10)
+ "}").getBytes(StandardCharsets.UTF_8);
private ServerBootstrap bootstrap;
private ServerSocketChannel serverSock;
Expand Down

0 comments on commit bbe8698

Please sign in to comment.