summaryrefslogtreecommitdiff
path: root/core/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test')
-rw-r--r--core/src/test/java/org/elasticsearch/common/settings/SettingTests.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/src/test/java/org/elasticsearch/common/settings/SettingTests.java b/core/src/test/java/org/elasticsearch/common/settings/SettingTests.java
index 0bb1abb37a..1ac94b6caa 100644
--- a/core/src/test/java/org/elasticsearch/common/settings/SettingTests.java
+++ b/core/src/test/java/org/elasticsearch/common/settings/SettingTests.java
@@ -154,6 +154,22 @@ public class SettingTests extends ESTestCase {
assertNull(ab2.get());
}
+ public void testDeprecatedSetting() {
+ final Setting<Boolean> deprecatedSetting = Setting.boolSetting("deprecated.foo.bar", false, Property.Deprecated);
+ final Settings settings = Settings.builder().put("deprecated.foo.bar", true).build();
+ final int iterations = randomIntBetween(0, 128);
+ for (int i = 0; i < iterations; i++) {
+ deprecatedSetting.get(settings);
+ }
+ if (iterations > 0) {
+ /*
+ * This tests that we log the deprecation warning exactly one time, otherwise we would have to assert the deprecation warning
+ * for each usage of the setting.
+ */
+ assertSettingDeprecationsAndWarnings(new Setting[]{deprecatedSetting});
+ }
+ }
+
public void testDefault() {
TimeValue defaultValue = TimeValue.timeValueMillis(randomIntBetween(0, 1000000));
Setting<TimeValue> setting =