Target only specific index in update settings test

With this commit we limit the update settings request to the index that
is used in `IndicesClientIT#testIndexPutSettings()`. This avoids
spurious exceptions involving other indices that might also be present
in the test cluster.

Closes #36931
Relates #37338
This commit is contained in:
Daniel Mitterdorfer 2019-01-23 12:19:54 +01:00 committed by GitHub
parent 1de286bfb3
commit 100537fbc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1177,7 +1177,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
createIndex(index, Settings.EMPTY); createIndex(index, Settings.EMPTY);
assertThat(dynamicSetting.getDefault(Settings.EMPTY), not(dynamicSettingValue)); assertThat(dynamicSetting.getDefault(Settings.EMPTY), not(dynamicSettingValue));
UpdateSettingsRequest dynamicSettingRequest = new UpdateSettingsRequest(); UpdateSettingsRequest dynamicSettingRequest = new UpdateSettingsRequest(index);
dynamicSettingRequest.settings(Settings.builder().put(dynamicSettingKey, dynamicSettingValue).build()); dynamicSettingRequest.settings(Settings.builder().put(dynamicSettingKey, dynamicSettingValue).build());
AcknowledgedResponse response = execute(dynamicSettingRequest, highLevelClient().indices()::putSettings, AcknowledgedResponse response = execute(dynamicSettingRequest, highLevelClient().indices()::putSettings,
highLevelClient().indices()::putSettingsAsync); highLevelClient().indices()::putSettingsAsync);
@ -1187,7 +1187,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
assertThat(indexSettingsAsMap.get(dynamicSettingKey), equalTo(String.valueOf(dynamicSettingValue))); assertThat(indexSettingsAsMap.get(dynamicSettingKey), equalTo(String.valueOf(dynamicSettingValue)));
assertThat(staticSetting.getDefault(Settings.EMPTY), not(staticSettingValue)); assertThat(staticSetting.getDefault(Settings.EMPTY), not(staticSettingValue));
UpdateSettingsRequest staticSettingRequest = new UpdateSettingsRequest(); UpdateSettingsRequest staticSettingRequest = new UpdateSettingsRequest(index);
staticSettingRequest.settings(Settings.builder().put(staticSettingKey, staticSettingValue).build()); staticSettingRequest.settings(Settings.builder().put(staticSettingKey, staticSettingValue).build());
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> execute(staticSettingRequest, ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> execute(staticSettingRequest,
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync)); highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync));
@ -1207,7 +1207,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
assertThat(indexSettingsAsMap.get(staticSettingKey), equalTo(staticSettingValue)); assertThat(indexSettingsAsMap.get(staticSettingKey), equalTo(staticSettingValue));
assertThat(unmodifiableSetting.getDefault(Settings.EMPTY), not(unmodifiableSettingValue)); assertThat(unmodifiableSetting.getDefault(Settings.EMPTY), not(unmodifiableSettingValue));
UpdateSettingsRequest unmodifiableSettingRequest = new UpdateSettingsRequest(); UpdateSettingsRequest unmodifiableSettingRequest = new UpdateSettingsRequest(index);
unmodifiableSettingRequest.settings(Settings.builder().put(unmodifiableSettingKey, unmodifiableSettingValue).build()); unmodifiableSettingRequest.settings(Settings.builder().put(unmodifiableSettingKey, unmodifiableSettingValue).build());
exception = expectThrows(ElasticsearchException.class, () -> execute(unmodifiableSettingRequest, exception = expectThrows(ElasticsearchException.class, () -> execute(unmodifiableSettingRequest,
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync)); highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync));