Skip to content

[9.1] Extend HTTP timeout in repo analysis tests (#131744) #132185

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

Open
wants to merge 1 commit into
base: 9.1
Choose a base branch
from
Open
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 @@ -7,9 +7,12 @@

package org.elasticsearch.repositories.blobstore.testkit.analyze;

import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpPost;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.test.rest.ESRestTestCase;

public abstract class AbstractRepositoryAnalysisRestTestCase extends ESRestTestCase {
Expand All @@ -26,12 +29,18 @@ public void testRepositoryAnalysis() throws Exception {
logger.info("creating repository [{}] of type [{}]", repository, repositoryType);
registerRepository(repository, repositoryType, true, repositorySettings);

final TimeValue timeout = TimeValue.timeValueSeconds(120);
final Request request = new Request(HttpPost.METHOD_NAME, "/_snapshot/" + repository + "/_analyze");
request.addParameter("blob_count", "10");
request.addParameter("concurrency", "4");
request.addParameter("max_blob_size", randomFrom("1mb", "10mb"));
request.addParameter("timeout", "120s");
request.addParameter("timeout", timeout.getStringRep());
request.addParameter("seed", Long.toString(randomLong()));
request.setOptions(
RequestOptions.DEFAULT.toBuilder()
.setRequestConfig(RequestConfig.custom().setSocketTimeout(Math.toIntExact(timeout.millis() + 10_000)).build())
);

assertOK(client().performRequest(request));
}

Expand Down