diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/UpgradeClusterClientYamlTestSuiteIT.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/UpgradeClusterClientYamlTestSuiteIT.java index 2977e783cf60d..6dfdbb987cc07 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/UpgradeClusterClientYamlTestSuiteIT.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/UpgradeClusterClientYamlTestSuiteIT.java @@ -55,6 +55,7 @@ protected Settings restClientSettings() { // increase the timeout so that we can actually see the result of failed cluster health // calls that have a default timeout of 30s .put(ESRestTestCase.CLIENT_RETRY_TIMEOUT, "40s") + .put(ESRestTestCase.CLIENT_SOCKET_TIMEOUT, "40s") .build(); } } diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index ce10c6315067b..0aed6fd137b59 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -69,6 +69,7 @@ public abstract class ESRestTestCase extends ESTestCase { public static final String TRUSTSTORE_PATH = "truststore.path"; public static final String TRUSTSTORE_PASSWORD = "truststore.password"; public static final String CLIENT_RETRY_TIMEOUT = "client.retry.timeout"; + public static final String CLIENT_SOCKET_TIMEOUT = "client.socket.timeout"; /** * Convert the entity from a {@link Response} into a map of maps. @@ -346,6 +347,11 @@ protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOE final TimeValue maxRetryTimeout = TimeValue.parseTimeValue(requestTimeoutString, CLIENT_RETRY_TIMEOUT); builder.setMaxRetryTimeoutMillis(Math.toIntExact(maxRetryTimeout.getMillis())); } + final String socketTimeoutString = settings.get(CLIENT_SOCKET_TIMEOUT); + if (socketTimeoutString != null) { + final TimeValue socketTimeout = TimeValue.parseTimeValue(socketTimeoutString, CLIENT_SOCKET_TIMEOUT); + builder.setRequestConfigCallback(conf -> conf.setSocketTimeout(Math.toIntExact(socketTimeout.getMillis()))); + } return builder.build(); }