Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Hamcrest matchers and assertThat() in ReindexRenamedSettingTests to improve readability #2503

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public void testReindexSettingsExist() {
*/
public void testSettingFallback() {
assertEquals(
TransportReindexAction.REMOTE_CLUSTER_ALLOWLIST.get(Settings.EMPTY),
TransportReindexAction.REMOTE_CLUSTER_WHITELIST.get(Settings.EMPTY)
TransportReindexAction.REMOTE_CLUSTER_WHITELIST.get(Settings.EMPTY),
TransportReindexAction.REMOTE_CLUSTER_ALLOWLIST.get(Settings.EMPTY)
);
}

Expand All @@ -51,10 +51,10 @@ public void testSettingFallback() {
*/
public void testSettingGetValue() {
Settings settings = Settings.builder().put("reindex.remote.allowlist", "127.0.0.1:*").build();
assertEquals(TransportReindexAction.REMOTE_CLUSTER_ALLOWLIST.get(settings), Arrays.asList("127.0.0.1:*"));
assertEquals(Arrays.asList("127.0.0.1:*"), TransportReindexAction.REMOTE_CLUSTER_ALLOWLIST.get(settings));
assertEquals(
TransportReindexAction.REMOTE_CLUSTER_WHITELIST.get(settings),
TransportReindexAction.REMOTE_CLUSTER_WHITELIST.getDefault(Settings.EMPTY)
TransportReindexAction.REMOTE_CLUSTER_WHITELIST.getDefault(Settings.EMPTY),
TransportReindexAction.REMOTE_CLUSTER_WHITELIST.get(settings)
);
}

Expand All @@ -63,7 +63,7 @@ public void testSettingGetValue() {
*/
public void testSettingGetValueWithFallback() {
Settings settings = Settings.builder().put("reindex.remote.whitelist", "127.0.0.1:*").build();
assertEquals(TransportReindexAction.REMOTE_CLUSTER_ALLOWLIST.get(settings), Arrays.asList("127.0.0.1:*"));
assertEquals(Arrays.asList("127.0.0.1:*"), TransportReindexAction.REMOTE_CLUSTER_ALLOWLIST.get(settings));
assertSettingDeprecationsAndWarnings(new Setting<?>[] { TransportReindexAction.REMOTE_CLUSTER_WHITELIST });
}

Expand All @@ -75,8 +75,8 @@ public void testSettingGetValueWhenBothAreConfigured() {
.put("reindex.remote.allowlist", "127.0.0.1:*")
.put("reindex.remote.whitelist", "[::1]:*, 127.0.0.1:*")
.build();
assertEquals(TransportReindexAction.REMOTE_CLUSTER_ALLOWLIST.get(settings), Arrays.asList("127.0.0.1:*"));
assertEquals(TransportReindexAction.REMOTE_CLUSTER_WHITELIST.get(settings), Arrays.asList("[::1]:*", "127.0.0.1:*"));
assertEquals(Arrays.asList("127.0.0.1:*"), TransportReindexAction.REMOTE_CLUSTER_ALLOWLIST.get(settings));
assertEquals(Arrays.asList("[::1]:*", "127.0.0.1:*"), TransportReindexAction.REMOTE_CLUSTER_WHITELIST.get(settings));
assertSettingDeprecationsAndWarnings(new Setting<?>[] { TransportReindexAction.REMOTE_CLUSTER_WHITELIST });
}

Expand Down