Skip to content

Commit

Permalink
Integration test that checks for settings upgrade (#1482)
Browse files Browse the repository at this point in the history
* Made changes.

Signed-off-by: Megha Sai Kavikondala <kavmegha@amazon.com>

* Signed-off-by: Megha Sai Kavikondala <kavmegha@amazon.com>

Changes made by deleting the TestSettingsIT file and adding new lines in FullClusterRestartSettingsUpgradeIT.java
  • Loading branch information
meghasaik authored Nov 9, 2021
1 parent 546ab21 commit fb78d10
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.opensearch.transport.RemoteClusterService.SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE;
import static org.opensearch.transport.SniffConnectionStrategy.SEARCH_REMOTE_CLUSTERS_SEEDS;
import static org.opensearch.transport.SniffConnectionStrategy.SEARCH_REMOTE_CLUSTERS_PROXY;
import static org.opensearch.transport.SniffConnectionStrategy.REMOTE_CLUSTERS_PROXY;
import static org.hamcrest.Matchers.equalTo;

public class FullClusterRestartSettingsUpgradeIT extends AbstractFullClusterRestartTestCase {
Expand All @@ -67,6 +69,7 @@ public void testRemoteClusterSettingsUpgraded() throws IOException {
{
builder.field("search.remote.foo.skip_unavailable", true);
builder.field("search.remote.foo.seeds", Collections.singletonList("localhost:9200"));
builder.field("search.remote.foo.proxy", "localhost:9200");
}
builder.endObject();
}
Expand All @@ -87,11 +90,15 @@ public void testRemoteClusterSettingsUpgraded() throws IOException {
assertThat(
SEARCH_REMOTE_CLUSTERS_SEEDS.getConcreteSettingForNamespace("foo").get(settings),
equalTo(Collections.singletonList("localhost:9200")));
assertTrue(SEARCH_REMOTE_CLUSTERS_PROXY.getConcreteSettingForNamespace("foo").exists(settings));
assertEquals(String.valueOf(SEARCH_REMOTE_CLUSTERS_PROXY.getConcreteSettingForNamespace("foo").get(settings)),
"localhost:9200");
}

assertSettingDeprecationsAndWarnings(new Setting<?>[]{
SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE.getConcreteSettingForNamespace("foo"),
SEARCH_REMOTE_CLUSTERS_SEEDS.getConcreteSettingForNamespace("foo")});
SEARCH_REMOTE_CLUSTERS_SEEDS.getConcreteSettingForNamespace("foo"),
SEARCH_REMOTE_CLUSTERS_PROXY.getConcreteSettingForNamespace("foo")});
} else {
final Request getSettingsRequest = new Request("GET", "/_cluster/settings");
final Response getSettingsResponse = client().performRequest(getSettingsRequest);
Expand All @@ -109,6 +116,10 @@ public void testRemoteClusterSettingsUpgraded() throws IOException {
assertThat(
SniffConnectionStrategy.REMOTE_CLUSTER_SEEDS.getConcreteSettingForNamespace("foo").get(settings),
equalTo(Collections.singletonList("localhost:9200")));
assertFalse(SEARCH_REMOTE_CLUSTERS_PROXY.getConcreteSettingForNamespace("foo").exists(settings));
assertTrue(REMOTE_CLUSTERS_PROXY.getConcreteSettingForNamespace("foo").exists(settings));
assertEquals(String.valueOf(REMOTE_CLUSTERS_PROXY.getConcreteSettingForNamespace("foo").get(settings)),
"localhost:9200");
}
}
}
Expand Down

0 comments on commit fb78d10

Please sign in to comment.