Skip to content
Merged
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 @@ -61,10 +61,10 @@
import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.features.NodeFeature;
import org.elasticsearch.http.HttpBodyTracer;
import org.elasticsearch.http.HttpServerTransport;
import org.elasticsearch.http.HttpTransportSettings;
import org.elasticsearch.index.IndexingPressure;
import org.elasticsearch.plugins.ActionPlugin;
import org.elasticsearch.plugins.Plugin;
Expand Down Expand Up @@ -107,6 +107,8 @@
import static io.netty.handler.codec.http.HttpHeaderValues.APPLICATION_JSON;
import static io.netty.handler.codec.http.HttpMethod.POST;
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_CLIENT_STATS_MAX_CLOSED_CHANNEL_AGE;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_MAX_CONTENT_LENGTH;
import static org.hamcrest.Matchers.anEmptyMap;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.greaterThan;
Expand All @@ -120,12 +122,13 @@ public class Netty4IncrementalRequestHandlingIT extends ESNetty4IntegTestCase {

@Override
protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
Settings.Builder builder = Settings.builder().put(super.nodeSettings(nodeOrdinal, otherSettings));
builder.put(
HttpTransportSettings.SETTING_HTTP_MAX_CONTENT_LENGTH.getKey(),
ByteSizeValue.of(MAX_CONTENT_LENGTH, ByteSizeUnit.BYTES)
);
return builder.build();
return Settings.builder()
.put(super.nodeSettings(nodeOrdinal, otherSettings))
// reduce max content length just to cut down test duration
.put(SETTING_HTTP_MAX_CONTENT_LENGTH.getKey(), ByteSizeValue.of(MAX_CONTENT_LENGTH, ByteSizeUnit.BYTES))
// disable time-based expiry of channel stats since we assert that the total request size accumulates
.put(SETTING_HTTP_CLIENT_STATS_MAX_CLOSED_CHANNEL_AGE.getKey(), TimeValue.MAX_VALUE)
.build();
}

// ensure empty http content has single 0 size chunk
Expand Down Expand Up @@ -436,7 +439,7 @@ public void testHttpClientStats() throws Exception {
clientContext.channel().writeAndFlush(httpRequest(opaqueId, contentSize));
clientContext.channel().writeAndFlush(randomContent(contentSize, true));
final var handler = clientContext.awaitRestChannelAccepted(opaqueId);
handler.readAllBytes();
assertEquals(contentSize, handler.readAllBytes());
handler.sendResponse(new RestResponse(RestStatus.OK, ""));
assertEquals(totalBytesSent, clientContext.transportStatsRequestBytesSize());
}
Expand Down