Test that transient settings beat persistent ones (#33818)
Transient settings override persistent settings, but in fact all of the tests that run as part of `:server:test` and `:server:integTest` will pass if the precedence is changed to be the other way round. This change adds a test that verifies the precedence is as documented.
This commit is contained in:
parent
6d3a7910f8
commit
c041e94349
|
@ -29,6 +29,7 @@ import org.elasticsearch.common.collect.ImmutableOpenMap;
|
|||
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -794,4 +795,12 @@ public class MetaDataTests extends ESTestCase {
|
|||
" }\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
public void testTransientSettingsOverridePersistentSettings() {
|
||||
final Setting setting = Setting.simpleString("key");
|
||||
final MetaData metaData = MetaData.builder()
|
||||
.persistentSettings(Settings.builder().put(setting.getKey(), "persistent-value").build())
|
||||
.transientSettings(Settings.builder().put(setting.getKey(), "transient-value").build()).build();
|
||||
assertThat(setting.get(metaData.settings()), equalTo("transient-value"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue