|
23 | 23 | import static org.hamcrest.Matchers.contains;
|
24 | 24 | import static org.hamcrest.Matchers.containsString;
|
25 | 25 | import static org.hamcrest.Matchers.empty;
|
| 26 | +import static org.hamcrest.Matchers.equalTo; |
26 | 27 | import static org.hamcrest.Matchers.not;
|
| 28 | +import static org.hamcrest.Matchers.nullValue; |
27 | 29 | import static org.hamcrest.Matchers.startsWith;
|
28 | 30 |
|
29 | 31 | public class NodeDeprecationChecksTests extends ESTestCase {
|
@@ -143,4 +145,29 @@ public void testCorrectRealmOrders() {
|
143 | 145 |
|
144 | 146 | assertEquals(0, deprecationIssues.size());
|
145 | 147 | }
|
| 148 | + |
| 149 | + public void testRemovedSettingNotSet() { |
| 150 | + final Settings settings = Settings.EMPTY; |
| 151 | + final Setting<?> removedSetting = Setting.simpleString("node.removed_setting"); |
| 152 | + final DeprecationIssue issue = |
| 153 | + NodeDeprecationChecks.checkRemovedSetting(settings, removedSetting, "http://removed-setting.example.com"); |
| 154 | + assertThat(issue, nullValue()); |
| 155 | + } |
| 156 | + |
| 157 | + public void testRemovedSetting() { |
| 158 | + final Settings settings = Settings.builder().put("node.removed_setting", "value").build(); |
| 159 | + final Setting<?> removedSetting = Setting.simpleString("node.removed_setting"); |
| 160 | + final DeprecationIssue issue = |
| 161 | + NodeDeprecationChecks.checkRemovedSetting(settings, removedSetting, "https://removed-setting.example.com"); |
| 162 | + assertThat(issue, not(nullValue())); |
| 163 | + assertThat(issue.getLevel(), equalTo(DeprecationIssue.Level.CRITICAL)); |
| 164 | + assertThat( |
| 165 | + issue.getMessage(), |
| 166 | + equalTo("setting [node.removed_setting] is deprecated and will be removed in the next major version")); |
| 167 | + assertThat( |
| 168 | + issue.getDetails(), |
| 169 | + equalTo("the setting [node.removed_setting] is currently set to [value], remove this setting")); |
| 170 | + assertThat(issue.getUrl(), equalTo("https://removed-setting.example.com")); |
| 171 | + } |
| 172 | + |
146 | 173 | }
|
0 commit comments