Replace parameter 'master_timeout' with 'cluster_manager_tiemout' in RequestConverters of High-Level-Rest-Client (#2683)

The REST API request parameter "master_timeout" will be deprecated in server version 3.0, and removed in 4.0. The alternative parameter "cluster_manager_timeout" is added in server 2.0 .
With the change in this commit, High-Level-Rest-Client will not be compatible with OpenSearch server 1.x (and below).
- Use parameter `cluster_manager_timeout` instead of `master_timeout` in High-Level-Rest-Client `RequestConverters` class for building REST requests
- Modify corresponding unit tests
- Change lots of "master timeout" in internal method and class names.

Signed-off-by: Tianli Feng <ftianli@amazon.com>
This commit is contained in:
Tianli Feng 2022-04-19 11:52:02 -07:00 committed by GitHub
parent ede26d945f
commit 18f4495f4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 109 additions and 101 deletions

View File

@ -58,7 +58,7 @@ final class ClusterRequestConverters {
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(clusterUpdateSettingsRequest.timeout());
parameters.withMasterTimeout(clusterUpdateSettingsRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(clusterUpdateSettingsRequest.masterNodeTimeout());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(clusterUpdateSettingsRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
return request;
@ -69,7 +69,7 @@ final class ClusterRequestConverters {
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withLocal(clusterGetSettingsRequest.local());
parameters.withIncludeDefaults(clusterGetSettingsRequest.includeDefaults());
parameters.withMasterTimeout(clusterGetSettingsRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(clusterGetSettingsRequest.masterNodeTimeout());
request.addParameters(parameters.asMap());
return request;
}
@ -88,7 +88,7 @@ final class ClusterRequestConverters {
.withWaitForNodes(healthRequest.waitForNodes())
.withWaitForEvents(healthRequest.waitForEvents())
.withTimeout(healthRequest.timeout())
.withMasterTimeout(healthRequest.masterNodeTimeout())
.withClusterManagerTimeout(healthRequest.masterNodeTimeout())
.withLocal(healthRequest.local())
.withLevel(healthRequest.level());
request.addParameters(params.asMap());
@ -105,7 +105,7 @@ final class ClusterRequestConverters {
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(putComponentTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(putComponentTemplateRequest.masterNodeTimeout());
if (putComponentTemplateRequest.create()) {
params.putParam("create", Boolean.TRUE.toString());
}
@ -124,7 +124,7 @@ final class ClusterRequestConverters {
final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(getComponentTemplatesRequest.isLocal());
params.withMasterTimeout(getComponentTemplatesRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(getComponentTemplatesRequest.getMasterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -136,7 +136,7 @@ final class ClusterRequestConverters {
final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(componentTemplatesRequest.isLocal());
params.withMasterTimeout(componentTemplatesRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(componentTemplatesRequest.getMasterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -146,7 +146,7 @@ final class ClusterRequestConverters {
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_component_template").addPathPart(name).build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(deleteComponentTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(deleteComponentTemplateRequest.masterNodeTimeout());
request.addParameters(params.asMap());
return request;
}

View File

@ -119,7 +119,7 @@ final class IndicesRequestConverters {
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(deleteIndexRequest.timeout());
parameters.withMasterTimeout(deleteIndexRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(deleteIndexRequest.masterNodeTimeout());
parameters.withIndicesOptions(deleteIndexRequest.indicesOptions());
request.addParameters(parameters.asMap());
return request;
@ -131,7 +131,7 @@ final class IndicesRequestConverters {
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(openIndexRequest.timeout());
parameters.withMasterTimeout(openIndexRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(openIndexRequest.masterNodeTimeout());
parameters.withWaitForActiveShards(openIndexRequest.waitForActiveShards());
parameters.withIndicesOptions(openIndexRequest.indicesOptions());
request.addParameters(parameters.asMap());
@ -144,7 +144,7 @@ final class IndicesRequestConverters {
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(closeIndexRequest.timeout());
parameters.withMasterTimeout(closeIndexRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(closeIndexRequest.masterNodeTimeout());
parameters.withIndicesOptions(closeIndexRequest.indicesOptions());
request.addParameters(parameters.asMap());
return request;
@ -156,7 +156,7 @@ final class IndicesRequestConverters {
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(createIndexRequest.timeout());
parameters.withMasterTimeout(createIndexRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(createIndexRequest.masterNodeTimeout());
parameters.withWaitForActiveShards(createIndexRequest.waitForActiveShards());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(createIndexRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
@ -168,7 +168,7 @@ final class IndicesRequestConverters {
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(indicesAliasesRequest.timeout());
parameters.withMasterTimeout(indicesAliasesRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(indicesAliasesRequest.masterNodeTimeout());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(indicesAliasesRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
return request;
@ -179,7 +179,7 @@ final class IndicesRequestConverters {
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(putMappingRequest.timeout());
parameters.withMasterTimeout(putMappingRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(putMappingRequest.masterNodeTimeout());
parameters.withIndicesOptions(putMappingRequest.indicesOptions());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(putMappingRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
@ -192,7 +192,7 @@ final class IndicesRequestConverters {
Request request = new Request(HttpGet.METHOD_NAME, RequestConverters.endpoint(indices, "_mapping"));
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withMasterTimeout(getMappingsRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(getMappingsRequest.masterNodeTimeout());
parameters.withIndicesOptions(getMappingsRequest.indicesOptions());
parameters.withLocal(getMappingsRequest.local());
request.addParameters(parameters.asMap());
@ -332,7 +332,7 @@ final class IndicesRequestConverters {
RequestConverters.Params params = new RequestConverters.Params();
params.withTimeout(resizeRequest.timeout());
params.withMasterTimeout(resizeRequest.masterNodeTimeout());
params.withClusterManagerTimeout(resizeRequest.masterNodeTimeout());
params.withWaitForActiveShards(resizeRequest.getWaitForActiveShards());
request.addParameters(params.asMap());
request.setEntity(RequestConverters.createEntity(resizeRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
@ -349,7 +349,7 @@ final class IndicesRequestConverters {
RequestConverters.Params params = new RequestConverters.Params();
params.withTimeout(resizeRequest.timeout());
params.withMasterTimeout(resizeRequest.masterNodeTimeout());
params.withClusterManagerTimeout(resizeRequest.masterNodeTimeout());
params.withWaitForActiveShards(resizeRequest.getTargetIndexRequest().waitForActiveShards());
request.addParameters(params.asMap());
request.setEntity(RequestConverters.createEntity(resizeRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
@ -365,7 +365,7 @@ final class IndicesRequestConverters {
RequestConverters.Params params = new RequestConverters.Params();
params.withTimeout(rolloverRequest.timeout());
params.withMasterTimeout(rolloverRequest.masterNodeTimeout());
params.withClusterManagerTimeout(rolloverRequest.masterNodeTimeout());
params.withWaitForActiveShards(rolloverRequest.getCreateIndexRequest().waitForActiveShards());
if (rolloverRequest.isDryRun()) {
params.putParam("dry_run", Boolean.TRUE.toString());
@ -386,7 +386,7 @@ final class IndicesRequestConverters {
params.withIndicesOptions(getSettingsRequest.indicesOptions());
params.withLocal(getSettingsRequest.local());
params.withIncludeDefaults(getSettingsRequest.includeDefaults());
params.withMasterTimeout(getSettingsRequest.masterNodeTimeout());
params.withClusterManagerTimeout(getSettingsRequest.masterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -402,7 +402,7 @@ final class IndicesRequestConverters {
params.withLocal(getIndexRequest.local());
params.withIncludeDefaults(getIndexRequest.includeDefaults());
params.withHuman(getIndexRequest.humanReadable());
params.withMasterTimeout(getIndexRequest.masterNodeTimeout());
params.withClusterManagerTimeout(getIndexRequest.masterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -429,7 +429,7 @@ final class IndicesRequestConverters {
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(updateSettingsRequest.timeout());
parameters.withMasterTimeout(updateSettingsRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(updateSettingsRequest.masterNodeTimeout());
parameters.withIndicesOptions(updateSettingsRequest.indicesOptions());
parameters.withPreserveExisting(updateSettingsRequest.isPreserveExisting());
request.addParameters(parameters.asMap());
@ -443,7 +443,7 @@ final class IndicesRequestConverters {
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(putIndexTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(putIndexTemplateRequest.masterNodeTimeout());
if (putIndexTemplateRequest.create()) {
params.putParam("create", Boolean.TRUE.toString());
}
@ -461,7 +461,7 @@ final class IndicesRequestConverters {
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(putIndexTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(putIndexTemplateRequest.masterNodeTimeout());
if (putIndexTemplateRequest.create()) {
params.putParam("create", Boolean.TRUE.toString());
}
@ -479,7 +479,7 @@ final class IndicesRequestConverters {
.build();
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(simulateIndexTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(simulateIndexTemplateRequest.masterNodeTimeout());
PutComposableIndexTemplateRequest putComposableIndexTemplateRequest = simulateIndexTemplateRequest.indexTemplateV2Request();
if (putComposableIndexTemplateRequest != null) {
if (putComposableIndexTemplateRequest.create()) {
@ -529,7 +529,7 @@ final class IndicesRequestConverters {
final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(getIndexTemplatesRequest.isLocal());
params.withMasterTimeout(getIndexTemplatesRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(getIndexTemplatesRequest.getMasterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -541,7 +541,7 @@ final class IndicesRequestConverters {
final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(getIndexTemplatesRequest.isLocal());
params.withMasterTimeout(getIndexTemplatesRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(getIndexTemplatesRequest.getMasterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -553,7 +553,7 @@ final class IndicesRequestConverters {
final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(indexTemplatesExistRequest.isLocal());
params.withMasterTimeout(indexTemplatesExistRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(indexTemplatesExistRequest.getMasterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -565,7 +565,7 @@ final class IndicesRequestConverters {
final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(indexTemplatesExistRequest.isLocal());
params.withMasterTimeout(indexTemplatesExistRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(indexTemplatesExistRequest.getMasterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -587,7 +587,7 @@ final class IndicesRequestConverters {
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template").addPathPart(name).build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(deleteIndexTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(deleteIndexTemplateRequest.masterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -597,7 +597,7 @@ final class IndicesRequestConverters {
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template").addPathPart(name).build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(deleteIndexTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(deleteIndexTemplateRequest.masterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -610,7 +610,7 @@ final class IndicesRequestConverters {
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(deleteAliasRequest.timeout());
parameters.withMasterTimeout(deleteAliasRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(deleteAliasRequest.masterNodeTimeout());
request.addParameters(parameters.asMap());
return request;
}

View File

@ -54,7 +54,7 @@ final class IngestRequestConverters {
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withMasterTimeout(getPipelineRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(getPipelineRequest.masterNodeTimeout());
request.addParameters(parameters.asMap());
return request;
}
@ -67,7 +67,7 @@ final class IngestRequestConverters {
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(putPipelineRequest.timeout());
parameters.withMasterTimeout(putPipelineRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(putPipelineRequest.masterNodeTimeout());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(putPipelineRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
return request;
@ -81,7 +81,7 @@ final class IngestRequestConverters {
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(deletePipelineRequest.timeout());
parameters.withMasterTimeout(deletePipelineRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(deletePipelineRequest.masterNodeTimeout());
request.addParameters(parameters.asMap());
return request;
}

View File

@ -702,7 +702,7 @@ final class RequestConverters {
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
Params params = new Params();
params.withTimeout(putStoredScriptRequest.timeout());
params.withMasterTimeout(putStoredScriptRequest.masterNodeTimeout());
params.withClusterManagerTimeout(putStoredScriptRequest.masterNodeTimeout());
if (Strings.hasText(putStoredScriptRequest.context())) {
params.putParam("context", putStoredScriptRequest.context());
}
@ -757,7 +757,7 @@ final class RequestConverters {
String endpoint = new EndpointBuilder().addPathPartAsIs("_scripts").addPathPart(getStoredScriptRequest.id()).build();
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
Params params = new Params();
params.withMasterTimeout(getStoredScriptRequest.masterNodeTimeout());
params.withClusterManagerTimeout(getStoredScriptRequest.masterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -767,7 +767,7 @@ final class RequestConverters {
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
Params params = new Params();
params.withTimeout(deleteStoredScriptRequest.timeout());
params.withMasterTimeout(deleteStoredScriptRequest.masterNodeTimeout());
params.withClusterManagerTimeout(deleteStoredScriptRequest.masterNodeTimeout());
request.addParameters(params.asMap());
return request;
}
@ -891,10 +891,18 @@ final class RequestConverters {
return this;
}
/**
* @deprecated As of 2.0, because supporting inclusive language, replaced by {@link #withClusterManagerTimeout(TimeValue)}
*/
@Deprecated
Params withMasterTimeout(TimeValue masterTimeout) {
return putParam("master_timeout", masterTimeout);
}
Params withClusterManagerTimeout(TimeValue clusterManagerTimeout) {
return putParam("cluster_manager_timeout", clusterManagerTimeout);
}
Params withPipeline(String pipeline) {
return putParam("pipeline", pipeline);
}

View File

@ -63,7 +63,7 @@ final class SnapshotRequestConverters {
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withMasterTimeout(getRepositoriesRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(getRepositoriesRequest.masterNodeTimeout());
parameters.withLocal(getRepositoriesRequest.local());
request.addParameters(parameters.asMap());
return request;
@ -74,7 +74,7 @@ final class SnapshotRequestConverters {
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withMasterTimeout(putRepositoryRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(putRepositoryRequest.masterNodeTimeout());
parameters.withTimeout(putRepositoryRequest.timeout());
if (putRepositoryRequest.verify() == false) {
parameters.putParam("verify", "false");
@ -91,7 +91,7 @@ final class SnapshotRequestConverters {
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withMasterTimeout(deleteRepositoryRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(deleteRepositoryRequest.masterNodeTimeout());
parameters.withTimeout(deleteRepositoryRequest.timeout());
request.addParameters(parameters.asMap());
return request;
@ -105,7 +105,7 @@ final class SnapshotRequestConverters {
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withMasterTimeout(verifyRepositoryRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(verifyRepositoryRequest.masterNodeTimeout());
parameters.withTimeout(verifyRepositoryRequest.timeout());
request.addParameters(parameters.asMap());
return request;
@ -119,7 +119,7 @@ final class SnapshotRequestConverters {
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withMasterTimeout(cleanupRepositoryRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(cleanupRepositoryRequest.masterNodeTimeout());
parameters.withTimeout(cleanupRepositoryRequest.timeout());
request.addParameters(parameters.asMap());
return request;
@ -132,7 +132,7 @@ final class SnapshotRequestConverters {
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(createSnapshotRequest.masterNodeTimeout());
params.withClusterManagerTimeout(createSnapshotRequest.masterNodeTimeout());
params.withWaitForCompletion(createSnapshotRequest.waitForCompletion());
request.addParameters(params.asMap());
request.setEntity(RequestConverters.createEntity(createSnapshotRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
@ -148,7 +148,7 @@ final class SnapshotRequestConverters {
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(cloneSnapshotRequest.masterNodeTimeout());
params.withClusterManagerTimeout(cloneSnapshotRequest.masterNodeTimeout());
request.addParameters(params.asMap());
request.setEntity(RequestConverters.createEntity(cloneSnapshotRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
return request;
@ -167,7 +167,7 @@ final class SnapshotRequestConverters {
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withMasterTimeout(getSnapshotsRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(getSnapshotsRequest.masterNodeTimeout());
parameters.putParam("ignore_unavailable", Boolean.toString(getSnapshotsRequest.ignoreUnavailable()));
parameters.putParam("verbose", Boolean.toString(getSnapshotsRequest.verbose()));
request.addParameters(parameters.asMap());
@ -183,7 +183,7 @@ final class SnapshotRequestConverters {
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withMasterTimeout(snapshotsStatusRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(snapshotsStatusRequest.masterNodeTimeout());
parameters.withIgnoreUnavailable(snapshotsStatusRequest.ignoreUnavailable());
request.addParameters(parameters.asMap());
return request;
@ -197,7 +197,7 @@ final class SnapshotRequestConverters {
.build();
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withMasterTimeout(restoreSnapshotRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(restoreSnapshotRequest.masterNodeTimeout());
parameters.withWaitForCompletion(restoreSnapshotRequest.waitForCompletion());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(restoreSnapshotRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
@ -212,7 +212,7 @@ final class SnapshotRequestConverters {
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withMasterTimeout(deleteSnapshotRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(deleteSnapshotRequest.masterNodeTimeout());
request.addParameters(parameters.asMap());
return request;
}

View File

@ -61,7 +61,7 @@ public class ClusterRequestConvertersTests extends OpenSearchTestCase {
public void testClusterPutSettings() throws IOException {
ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(request, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(request, expectedParams);
RequestConvertersTests.setRandomTimeout(request::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
Request expectedRequest = ClusterRequestConverters.clusterPutSettings(request);
@ -73,7 +73,7 @@ public class ClusterRequestConvertersTests extends OpenSearchTestCase {
public void testClusterGetSettings() throws IOException {
ClusterGetSettingsRequest request = new ClusterGetSettingsRequest();
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(request, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(request, expectedParams);
request.includeDefaults(OpenSearchTestCase.randomBoolean());
if (request.includeDefaults()) {
expectedParams.put("include_defaults", String.valueOf(true));
@ -96,23 +96,23 @@ public class ClusterRequestConvertersTests extends OpenSearchTestCase {
case "timeout":
healthRequest.timeout(timeout);
expectedParams.put("timeout", timeout);
// If Master Timeout wasn't set it uses the same value as Timeout
expectedParams.put("master_timeout", timeout);
// If Cluster Manager Timeout wasn't set it uses the same value as Timeout
expectedParams.put("cluster_manager_timeout", timeout);
break;
case "masterTimeout":
expectedParams.put("timeout", "30s");
healthRequest.masterNodeTimeout(masterTimeout);
expectedParams.put("master_timeout", masterTimeout);
expectedParams.put("cluster_manager_timeout", masterTimeout);
break;
case "both":
healthRequest.timeout(timeout);
expectedParams.put("timeout", timeout);
healthRequest.masterNodeTimeout(timeout);
expectedParams.put("master_timeout", timeout);
expectedParams.put("cluster_manager_timeout", timeout);
break;
case "none":
expectedParams.put("timeout", "30s");
expectedParams.put("master_timeout", "30s");
expectedParams.put("cluster_manager_timeout", "30s");
break;
default:
throw new UnsupportedOperationException();

View File

@ -144,7 +144,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomTimeout(createIndexRequest, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
RequestConvertersTests.setRandomMasterTimeout(createIndexRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(createIndexRequest, expectedParams);
RequestConvertersTests.setRandomWaitForActiveShards(createIndexRequest::waitForActiveShards, expectedParams);
Request request = IndicesRequestConverters.createIndex(createIndexRequest);
@ -166,7 +166,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomTimeout(indicesAliasesRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
RequestConvertersTests.setRandomMasterTimeout(indicesAliasesRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(indicesAliasesRequest, expectedParams);
Request request = IndicesRequestConverters.updateAliases(indicesAliasesRequest);
Assert.assertEquals("/_aliases", request.getEndpoint());
@ -180,7 +180,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomTimeout(putMappingRequest, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
RequestConvertersTests.setRandomMasterTimeout(putMappingRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(putMappingRequest, expectedParams);
RequestConvertersTests.setRandomIndicesOptions(
putMappingRequest::indicesOptions,
putMappingRequest::indicesOptions,
@ -219,7 +219,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
getMappingRequest::indicesOptions,
expectedParams
);
RequestConvertersTests.setRandomMasterTimeout(getMappingRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(getMappingRequest, expectedParams);
RequestConvertersTests.setRandomLocal(getMappingRequest::local, expectedParams);
Request request = IndicesRequestConverters.getMappings(getMappingRequest);
@ -313,7 +313,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomTimeout(deleteIndexRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
RequestConvertersTests.setRandomMasterTimeout(deleteIndexRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(deleteIndexRequest, expectedParams);
RequestConvertersTests.setRandomIndicesOptions(
deleteIndexRequest::indicesOptions,
@ -334,7 +334,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
GetSettingsRequest getSettingsRequest = new GetSettingsRequest().indices(indicesUnderTest);
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(getSettingsRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(getSettingsRequest, expectedParams);
RequestConvertersTests.setRandomIndicesOptions(
getSettingsRequest::indicesOptions,
getSettingsRequest::indicesOptions,
@ -385,7 +385,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
GetIndexRequest getIndexRequest = new GetIndexRequest(indicesUnderTest);
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(getIndexRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(getIndexRequest, expectedParams);
RequestConvertersTests.setRandomIndicesOptions(getIndexRequest::indicesOptions, getIndexRequest::indicesOptions, expectedParams);
RequestConvertersTests.setRandomLocal(getIndexRequest::local, expectedParams);
RequestConvertersTests.setRandomHumanReadable(getIndexRequest::humanReadable, expectedParams);
@ -425,7 +425,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomTimeout(openIndexRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
RequestConvertersTests.setRandomMasterTimeout(openIndexRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(openIndexRequest, expectedParams);
RequestConvertersTests.setRandomIndicesOptions(openIndexRequest::indicesOptions, openIndexRequest::indicesOptions, expectedParams);
RequestConvertersTests.setRandomWaitForActiveShards(openIndexRequest::waitForActiveShards, expectedParams);
@ -453,7 +453,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
AcknowledgedRequest.DEFAULT_ACK_TIMEOUT,
expectedParams
);
RequestConvertersTests.setRandomMasterTimeout(closeIndexRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(closeIndexRequest, expectedParams);
RequestConvertersTests.setRandomIndicesOptions(
closeIndexRequest::indicesOptions,
closeIndexRequest::indicesOptions,
@ -680,7 +680,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
String[] indices = RequestConvertersTests.randomIndicesNames(2, 2);
ResizeRequest resizeRequest = new ResizeRequest(indices[0], indices[1]);
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(resizeRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(resizeRequest, expectedParams);
RequestConvertersTests.setRandomTimeout(
s -> resizeRequest.setTimeout(TimeValue.parseTimeValue(s, "timeout")),
resizeRequest.timeout(),
@ -723,7 +723,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
);
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomTimeout(rolloverRequest, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
RequestConvertersTests.setRandomMasterTimeout(rolloverRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(rolloverRequest, expectedParams);
if (OpenSearchTestCase.randomBoolean()) {
rolloverRequest.dryRun(OpenSearchTestCase.randomBoolean());
if (rolloverRequest.isDryRun()) {
@ -796,7 +796,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
String[] indices = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 2);
UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(indices);
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(updateSettingsRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(updateSettingsRequest, expectedParams);
RequestConvertersTests.setRandomTimeout(updateSettingsRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
RequestConvertersTests.setRandomIndicesOptions(
updateSettingsRequest::indicesOptions,
@ -866,7 +866,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
putTemplateRequest.cause(cause);
expectedParams.put("cause", cause);
}
RequestConvertersTests.setRandomMasterTimeout(putTemplateRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(putTemplateRequest, expectedParams);
Request request = IndicesRequestConverters.putTemplate(putTemplateRequest);
Assert.assertThat(request.getEndpoint(), equalTo("/_template/" + names.get(putTemplateRequest.name())));
@ -917,7 +917,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
List<String> names = OpenSearchTestCase.randomSubsetOf(1, encodes.keySet());
GetIndexTemplatesRequest getTemplatesRequest = new GetIndexTemplatesRequest(names);
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(getTemplatesRequest::setMasterNodeTimeout, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(getTemplatesRequest::setMasterNodeTimeout, expectedParams);
RequestConvertersTests.setRandomLocal(getTemplatesRequest::setLocal, expectedParams);
Request request = IndicesRequestConverters.getTemplates(getTemplatesRequest);
@ -946,7 +946,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
);
final Map<String, String> expectedParams = new HashMap<>();
final IndexTemplatesExistRequest indexTemplatesExistRequest = new IndexTemplatesExistRequest(names);
RequestConvertersTests.setRandomMasterTimeout(indexTemplatesExistRequest::setMasterNodeTimeout, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(indexTemplatesExistRequest::setMasterNodeTimeout, expectedParams);
RequestConvertersTests.setRandomLocal(indexTemplatesExistRequest::setLocal, expectedParams);
assertThat(indexTemplatesExistRequest.names(), equalTo(names));
@ -973,7 +973,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
encodes.put("foo^bar", "foo%5Ebar");
DeleteIndexTemplateRequest deleteTemplateRequest = new DeleteIndexTemplateRequest().name(randomFrom(encodes.keySet()));
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(deleteTemplateRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(deleteTemplateRequest, expectedParams);
Request request = IndicesRequestConverters.deleteTemplate(deleteTemplateRequest);
Assert.assertThat(request.getMethod(), equalTo(HttpDelete.METHOD_NAME));
Assert.assertThat(request.getEndpoint(), equalTo("/_template/" + encodes.get(deleteTemplateRequest.name())));
@ -985,7 +985,7 @@ public class IndicesRequestConvertersTests extends OpenSearchTestCase {
DeleteAliasRequest deleteAliasRequest = new DeleteAliasRequest(randomAlphaOfLength(4), randomAlphaOfLength(4));
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(deleteAliasRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(deleteAliasRequest, expectedParams);
RequestConvertersTests.setRandomTimeout(deleteAliasRequest, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
Request request = IndicesRequestConverters.deleteAlias(deleteAliasRequest);

View File

@ -62,7 +62,7 @@ public class IngestRequestConvertersTests extends OpenSearchTestCase {
XContentType.JSON
);
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(request, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(request, expectedParams);
RequestConvertersTests.setRandomTimeout(request::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
Request expectedRequest = IngestRequestConverters.putPipeline(request);
@ -78,7 +78,7 @@ public class IngestRequestConvertersTests extends OpenSearchTestCase {
String pipelineId = "some_pipeline_id";
Map<String, String> expectedParams = new HashMap<>();
GetPipelineRequest request = new GetPipelineRequest("some_pipeline_id");
RequestConvertersTests.setRandomMasterTimeout(request, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(request, expectedParams);
Request expectedRequest = IngestRequestConverters.getPipeline(request);
StringJoiner endpoint = new StringJoiner("/", "/", "");
endpoint.add("_ingest/pipeline");
@ -92,7 +92,7 @@ public class IngestRequestConvertersTests extends OpenSearchTestCase {
String pipelineId = "some_pipeline_id";
Map<String, String> expectedParams = new HashMap<>();
DeletePipelineRequest request = new DeletePipelineRequest(pipelineId);
RequestConvertersTests.setRandomMasterTimeout(request, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(request, expectedParams);
RequestConvertersTests.setRandomTimeout(request::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
Request expectedRequest = IngestRequestConverters.deletePipeline(request);
StringJoiner endpoint = new StringJoiner("/", "/", "");

View File

@ -1663,7 +1663,7 @@ public class RequestConvertersTests extends OpenSearchTestCase {
}
Map<String, String> expectedParams = new HashMap<>();
setRandomMasterTimeout(putStoredScriptRequest, expectedParams);
setRandomClusterManagerTimeout(putStoredScriptRequest, expectedParams);
setRandomTimeout(putStoredScriptRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
if (randomBoolean()) {
@ -1694,7 +1694,7 @@ public class RequestConvertersTests extends OpenSearchTestCase {
public void testGetScriptRequest() {
GetStoredScriptRequest getStoredScriptRequest = new GetStoredScriptRequest("x-script");
Map<String, String> expectedParams = new HashMap<>();
setRandomMasterTimeout(getStoredScriptRequest, expectedParams);
setRandomClusterManagerTimeout(getStoredScriptRequest, expectedParams);
Request request = RequestConverters.getScript(getStoredScriptRequest);
assertThat(request.getEndpoint(), equalTo("/_scripts/" + getStoredScriptRequest.id()));
@ -1708,7 +1708,7 @@ public class RequestConvertersTests extends OpenSearchTestCase {
Map<String, String> expectedParams = new HashMap<>();
setRandomTimeout(deleteStoredScriptRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
setRandomMasterTimeout(deleteStoredScriptRequest, expectedParams);
setRandomClusterManagerTimeout(deleteStoredScriptRequest, expectedParams);
Request request = RequestConverters.deleteScript(deleteStoredScriptRequest);
assertThat(request.getEndpoint(), equalTo("/_scripts/" + deleteStoredScriptRequest.id()));
@ -2105,34 +2105,34 @@ public class RequestConvertersTests extends OpenSearchTestCase {
}
}
static void setRandomMasterTimeout(MasterNodeRequest<?> request, Map<String, String> expectedParams) {
setRandomMasterTimeout(request::masterNodeTimeout, expectedParams);
static void setRandomClusterManagerTimeout(MasterNodeRequest<?> request, Map<String, String> expectedParams) {
setRandomClusterManagerTimeout(request::masterNodeTimeout, expectedParams);
}
static void setRandomMasterTimeout(TimedRequest request, Map<String, String> expectedParams) {
setRandomMasterTimeout(
static void setRandomClusterManagerTimeout(TimedRequest request, Map<String, String> expectedParams) {
setRandomClusterManagerTimeout(
s -> request.setMasterTimeout(TimeValue.parseTimeValue(s, request.getClass().getName() + ".masterNodeTimeout")),
expectedParams
);
}
static void setRandomMasterTimeout(Consumer<String> setter, Map<String, String> expectedParams) {
static void setRandomClusterManagerTimeout(Consumer<String> setter, Map<String, String> expectedParams) {
if (randomBoolean()) {
String masterTimeout = randomTimeValue();
setter.accept(masterTimeout);
expectedParams.put("master_timeout", masterTimeout);
String clusterManagerTimeout = randomTimeValue();
setter.accept(clusterManagerTimeout);
expectedParams.put("cluster_manager_timeout", clusterManagerTimeout);
} else {
expectedParams.put("master_timeout", MasterNodeRequest.DEFAULT_MASTER_NODE_TIMEOUT.getStringRep());
expectedParams.put("cluster_manager_timeout", MasterNodeRequest.DEFAULT_MASTER_NODE_TIMEOUT.getStringRep());
}
}
static void setRandomMasterTimeout(Consumer<TimeValue> setter, TimeValue defaultTimeout, Map<String, String> expectedParams) {
static void setRandomClusterManagerTimeout(Consumer<TimeValue> setter, TimeValue defaultTimeout, Map<String, String> expectedParams) {
if (randomBoolean()) {
TimeValue masterTimeout = TimeValue.parseTimeValue(randomTimeValue(), "random_master_timeout");
setter.accept(masterTimeout);
expectedParams.put("master_timeout", masterTimeout.getStringRep());
TimeValue clusterManagerTimeout = TimeValue.parseTimeValue(randomTimeValue(), "random_master_timeout");
setter.accept(clusterManagerTimeout);
expectedParams.put("cluster_manager_timeout", clusterManagerTimeout.getStringRep());
} else {
expectedParams.put("master_timeout", defaultTimeout.getStringRep());
expectedParams.put("cluster_manager_timeout", defaultTimeout.getStringRep());
}
}

View File

@ -70,7 +70,7 @@ public class SnapshotRequestConvertersTests extends OpenSearchTestCase {
StringBuilder endpoint = new StringBuilder("/_snapshot");
GetRepositoriesRequest getRepositoriesRequest = new GetRepositoriesRequest();
RequestConvertersTests.setRandomMasterTimeout(getRepositoriesRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(getRepositoriesRequest, expectedParams);
RequestConvertersTests.setRandomLocal(getRepositoriesRequest::local, expectedParams);
if (randomBoolean()) {
@ -121,7 +121,7 @@ public class SnapshotRequestConvertersTests extends OpenSearchTestCase {
DeleteRepositoryRequest deleteRepositoryRequest = new DeleteRepositoryRequest();
deleteRepositoryRequest.name(repository);
RequestConvertersTests.setRandomMasterTimeout(deleteRepositoryRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(deleteRepositoryRequest, expectedParams);
RequestConvertersTests.setRandomTimeout(deleteRepositoryRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
Request request = SnapshotRequestConverters.deleteRepository(deleteRepositoryRequest);
@ -137,7 +137,7 @@ public class SnapshotRequestConvertersTests extends OpenSearchTestCase {
String endpoint = "/_snapshot/" + repository + "/_verify";
VerifyRepositoryRequest verifyRepositoryRequest = new VerifyRepositoryRequest(repository);
RequestConvertersTests.setRandomMasterTimeout(verifyRepositoryRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(verifyRepositoryRequest, expectedParams);
RequestConvertersTests.setRandomTimeout(verifyRepositoryRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
Request request = SnapshotRequestConverters.verifyRepository(verifyRepositoryRequest);
@ -153,7 +153,7 @@ public class SnapshotRequestConvertersTests extends OpenSearchTestCase {
String endpoint = "/_snapshot/" + repository + "/" + snapshot;
CreateSnapshotRequest createSnapshotRequest = new CreateSnapshotRequest(repository, snapshot);
RequestConvertersTests.setRandomMasterTimeout(createSnapshotRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(createSnapshotRequest, expectedParams);
Boolean waitForCompletion = randomBoolean();
createSnapshotRequest.waitForCompletion(waitForCompletion);
@ -177,7 +177,7 @@ public class SnapshotRequestConvertersTests extends OpenSearchTestCase {
GetSnapshotsRequest getSnapshotsRequest = new GetSnapshotsRequest();
getSnapshotsRequest.repository(repository);
getSnapshotsRequest.snapshots(Arrays.asList(snapshot1, snapshot2).toArray(new String[0]));
RequestConvertersTests.setRandomMasterTimeout(getSnapshotsRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(getSnapshotsRequest, expectedParams);
if (randomBoolean()) {
boolean ignoreUnavailable = randomBoolean();
@ -209,7 +209,7 @@ public class SnapshotRequestConvertersTests extends OpenSearchTestCase {
String endpoint = String.format(Locale.ROOT, "/_snapshot/%s/_all", repository);
GetSnapshotsRequest getSnapshotsRequest = new GetSnapshotsRequest(repository);
RequestConvertersTests.setRandomMasterTimeout(getSnapshotsRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(getSnapshotsRequest, expectedParams);
boolean ignoreUnavailable = randomBoolean();
getSnapshotsRequest.ignoreUnavailable(ignoreUnavailable);
@ -238,7 +238,7 @@ public class SnapshotRequestConvertersTests extends OpenSearchTestCase {
String endpoint = "/_snapshot/" + repository + "/" + snapshotNames.toString() + "/_status";
SnapshotsStatusRequest snapshotsStatusRequest = new SnapshotsStatusRequest(repository, snapshots);
RequestConvertersTests.setRandomMasterTimeout(snapshotsStatusRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(snapshotsStatusRequest, expectedParams);
snapshotsStatusRequest.ignoreUnavailable(ignoreUnavailable);
expectedParams.put("ignore_unavailable", Boolean.toString(ignoreUnavailable));
@ -256,7 +256,7 @@ public class SnapshotRequestConvertersTests extends OpenSearchTestCase {
String endpoint = String.format(Locale.ROOT, "/_snapshot/%s/%s/_restore", repository, snapshot);
RestoreSnapshotRequest restoreSnapshotRequest = new RestoreSnapshotRequest(repository, snapshot);
RequestConvertersTests.setRandomMasterTimeout(restoreSnapshotRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(restoreSnapshotRequest, expectedParams);
boolean waitForCompletion = randomBoolean();
restoreSnapshotRequest.waitForCompletion(waitForCompletion);
expectedParams.put("wait_for_completion", Boolean.toString(waitForCompletion));
@ -264,7 +264,7 @@ public class SnapshotRequestConvertersTests extends OpenSearchTestCase {
if (randomBoolean()) {
String timeout = randomTimeValue();
restoreSnapshotRequest.masterNodeTimeout(timeout);
expectedParams.put("master_timeout", timeout);
expectedParams.put("cluster_manager_timeout", timeout);
}
Request request = SnapshotRequestConverters.restoreSnapshot(restoreSnapshotRequest);
@ -284,7 +284,7 @@ public class SnapshotRequestConvertersTests extends OpenSearchTestCase {
DeleteSnapshotRequest deleteSnapshotRequest = new DeleteSnapshotRequest();
deleteSnapshotRequest.repository(repository);
deleteSnapshotRequest.snapshots(snapshot);
RequestConvertersTests.setRandomMasterTimeout(deleteSnapshotRequest, expectedParams);
RequestConvertersTests.setRandomClusterManagerTimeout(deleteSnapshotRequest, expectedParams);
Request request = SnapshotRequestConverters.deleteSnapshot(deleteSnapshotRequest);
assertThat(request.getEndpoint(), equalTo(endpoint));