Search in sources :

Example 41 with Settings

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.

the class DiscoveryNodeFiltersTests method testIpBindFilteringMatchingAnd.

public void testIpBindFilteringMatchingAnd() {
    Settings settings = shuffleSettings(Settings.builder().put("xxx.tag", "A").put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "192.1.1.54").build());
    DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(AND, "xxx.", settings);
    DiscoveryNode node = new DiscoveryNode("", "", "", "", "192.1.1.54", localAddress, singletonMap("tag", "A"), emptySet(), null);
    assertThat(filters.match(node), equalTo(true));
}
Also used : Settings(org.elasticsearch.common.settings.Settings)

Example 42 with Settings

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.

the class DiscoveryNodeFiltersTests method testIdMatch.

public void testIdMatch() {
    Settings settings = Settings.builder().put("xxx._id", "id1").build();
    DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings);
    DiscoveryNode node = new DiscoveryNode("name1", "id1", buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT);
    assertThat(filters.match(node), equalTo(true));
    node = new DiscoveryNode("name2", "id2", buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT);
    assertThat(filters.match(node), equalTo(false));
}
Also used : Settings(org.elasticsearch.common.settings.Settings)

Example 43 with Settings

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.

the class DiscoveryNodeFiltersTests method testIpPublishFilteringNotMatchingAnd.

public void testIpPublishFilteringNotMatchingAnd() {
    Settings settings = shuffleSettings(Settings.builder().put("xxx.tag", "A").put("xxx._publish_ip", "8.8.8.8").build());
    DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(AND, "xxx.", settings);
    DiscoveryNode node = new DiscoveryNode("", "", "", "", "192.1.1.54", localAddress, singletonMap("tag", "A"), emptySet(), null);
    assertThat(filters.match(node), equalTo(false));
}
Also used : Settings(org.elasticsearch.common.settings.Settings)

Example 44 with Settings

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.

the class DiscoveryNodeFiltersTests method testIpPublishFilteringMatchingAnd.

public void testIpPublishFilteringMatchingAnd() {
    Settings settings = shuffleSettings(Settings.builder().put("xxx.tag", "A").put("xxx._publish_ip", "192.1.1.54").build());
    DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(AND, "xxx.", settings);
    DiscoveryNode node = new DiscoveryNode("", "", "", "", "192.1.1.54", localAddress, singletonMap("tag", "A"), emptySet(), null);
    assertThat(filters.match(node), equalTo(true));
}
Also used : Settings(org.elasticsearch.common.settings.Settings)

Example 45 with Settings

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.settings.Settings in project elasticsearch by elastic.

the class DiscoveryNodeFiltersTests method testIpBindFilteringNotMatchingOr.

public void testIpBindFilteringNotMatchingOr() {
    Settings settings = shuffleSettings(Settings.builder().put("xxx.tag", "A").put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "8.8.8.8").build());
    DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings);
    DiscoveryNode node = new DiscoveryNode("", "", "", "", "192.1.1.54", localAddress, singletonMap("tag", "A"), emptySet(), null);
    assertThat(filters.match(node), equalTo(true));
}
Also used : Settings(org.elasticsearch.common.settings.Settings)

Aggregations

Settings (org.elasticsearch.common.settings.Settings)1248 Test (org.junit.Test)197 IndexSettings (org.elasticsearch.index.IndexSettings)167 IOException (java.io.IOException)133 Path (java.nio.file.Path)121 ClusterState (org.elasticsearch.cluster.ClusterState)120 ArrayList (java.util.ArrayList)108 ClusterSettings (org.elasticsearch.common.settings.ClusterSettings)106 HashMap (java.util.HashMap)105 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)98 Version (org.elasticsearch.Version)91 Matchers.containsString (org.hamcrest.Matchers.containsString)91 Environment (org.elasticsearch.env.Environment)87 Map (java.util.Map)85 List (java.util.List)79 IndexMetaData (org.elasticsearch.cluster.metadata.IndexMetaData)72 Index (org.elasticsearch.index.Index)70 HashSet (java.util.HashSet)58 IndexMetadata (org.elasticsearch.cluster.metadata.IndexMetadata)54 ThreadPool (org.elasticsearch.threadpool.ThreadPool)54