Skip to content

Commit faa79fe

Browse files
committed
Revert ClusterClientIT changes
1 parent 7248f0a commit faa79fe

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/ClusterClientIT.java

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import java.util.HashMap;
5050
import java.util.List;
5151
import java.util.Map;
52+
import java.util.function.BiConsumer;
5253

5354
import static java.util.Collections.emptyMap;
5455
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
@@ -73,11 +74,13 @@ public void testClusterPutSettings() throws IOException {
7374
ClusterUpdateSettingsRequest setRequest = new ClusterUpdateSettingsRequest();
7475
setRequest.transientSettings(transientSettings);
7576
setRequest.persistentSettings(map);
77+
RequestOptions options = RequestOptions.DEFAULT.toBuilder().setWarningsHandler(WarningsHandler.PERMISSIVE).build();
7678

7779
ClusterUpdateSettingsResponse setResponse = execute(
7880
setRequest,
7981
highLevelClient().cluster()::putSettings,
80-
highLevelClient().cluster()::putSettingsAsync
82+
highLevelClient().cluster()::putSettingsAsync,
83+
options
8184
);
8285

8386
assertAcked(setResponse);
@@ -104,7 +107,8 @@ public void testClusterPutSettings() throws IOException {
104107
ClusterUpdateSettingsResponse resetResponse = execute(
105108
resetRequest,
106109
highLevelClient().cluster()::putSettings,
107-
highLevelClient().cluster()::putSettingsAsync
110+
highLevelClient().cluster()::putSettingsAsync,
111+
options
108112
);
109113

110114
assertThat(resetResponse.getTransientSettings().get(transientSettingKey), equalTo(null));
@@ -119,11 +123,22 @@ public void testClusterPutSettings() throws IOException {
119123
assertThat(persistentResetValue, equalTo(null));
120124
}
121125

122-
public void testClusterUpdateSettingNonExistent() {
126+
public void testClusterUpdateTransientSettingNonExistent() {
127+
testClusterUpdateSettingNonExistent((settings, request) -> request.transientSettings(settings), "transient");
128+
}
129+
130+
public void testClusterUpdatePersistentSettingNonExistent() {
131+
testClusterUpdateSettingNonExistent((settings, request) -> request.persistentSettings(settings), "persistent");
132+
}
133+
134+
private void testClusterUpdateSettingNonExistent(
135+
final BiConsumer<Settings.Builder, ClusterUpdateSettingsRequest> consumer,
136+
String label
137+
) {
123138
String setting = "no_idea_what_you_are_talking_about";
124139
int value = 10;
125140
ClusterUpdateSettingsRequest clusterUpdateSettingsRequest = new ClusterUpdateSettingsRequest();
126-
clusterUpdateSettingsRequest.transientSettings(Settings.builder().put(setting, value).build());
141+
consumer.accept(Settings.builder().put(setting, value), clusterUpdateSettingsRequest);
127142

128143
ElasticsearchException exception = expectThrows(
129144
ElasticsearchException.class,
@@ -136,7 +151,9 @@ public void testClusterUpdateSettingNonExistent() {
136151
assertThat(exception.status(), equalTo(RestStatus.BAD_REQUEST));
137152
assertThat(
138153
exception.getMessage(),
139-
equalTo("Elasticsearch exception [type=illegal_argument_exception, reason=transient setting [" + setting + "], not recognized]")
154+
equalTo(
155+
"Elasticsearch exception [type=illegal_argument_exception, reason=" + label + " setting [" + setting + "], not recognized]"
156+
)
140157
);
141158
}
142159

@@ -331,13 +348,13 @@ public void testRemoteInfo() throws Exception {
331348
ClusterGetSettingsResponse settingsResponse = highLevelClient().cluster().getSettings(settingsRequest, RequestOptions.DEFAULT);
332349

333350
List<String> seeds = SniffConnectionStrategy.REMOTE_CLUSTER_SEEDS.getConcreteSettingForNamespace(clusterAlias)
334-
.get(settingsResponse.getTransientSettings());
335-
int connectionsPerCluster = SniffConnectionStrategy.REMOTE_CONNECTIONS_PER_CLUSTER.get(settingsResponse.getTransientSettings());
351+
.get(settingsResponse.getPersistentSettings());
352+
int connectionsPerCluster = SniffConnectionStrategy.REMOTE_CONNECTIONS_PER_CLUSTER.get(settingsResponse.getPersistentSettings());
336353
TimeValue initialConnectionTimeout = RemoteClusterService.REMOTE_INITIAL_CONNECTION_TIMEOUT_SETTING.get(
337-
settingsResponse.getTransientSettings()
354+
settingsResponse.getPersistentSettings()
338355
);
339356
boolean skipUnavailable = RemoteClusterService.REMOTE_CLUSTER_SKIP_UNAVAILABLE.getConcreteSettingForNamespace(clusterAlias)
340-
.get(settingsResponse.getTransientSettings());
357+
.get(settingsResponse.getPersistentSettings());
341358

342359
RemoteInfoRequest request = new RemoteInfoRequest();
343360
RemoteInfoResponse response = execute(

0 commit comments

Comments
 (0)