Search in sources :

Example 6 with NodesSniffer

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.NodesSniffer in project graylog2-server by Graylog2.

the class FilteredElasticsearchNodesSnifferTest method returnsNoNodesIfFilterDoesNotMatch.

@Test
void returnsNoNodesIfFilterDoesNotMatch() throws Exception {
    final List<Node> nodes = mockNodes();
    final NodesSniffer nodesSniffer = new FilteredElasticsearchNodesSniffer(mockSniffer(nodes), "location", "alaska");
    assertThat(nodesSniffer.sniff()).isEmpty();
}
Also used : Node(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Node) NodesSniffer(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.NodesSniffer) Test(org.junit.jupiter.api.Test)

Example 7 with NodesSniffer

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.NodesSniffer in project graylog2-server by Graylog2.

the class FilteredElasticsearchNodesSnifferTest method returnsNodesMatchingGivenFilter.

@Test
void returnsNodesMatchingGivenFilter() throws Exception {
    final List<Node> nodes = mockNodes();
    final NodesSniffer nodesSniffer = new FilteredElasticsearchNodesSniffer(mockSniffer(nodes), "rack", "42");
    assertThat(nodesSniffer.sniff()).containsExactly(nodeOnRack42);
}
Also used : Node(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Node) NodesSniffer(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.NodesSniffer) Test(org.junit.jupiter.api.Test)

Example 8 with NodesSniffer

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.NodesSniffer in project graylog2-server by Graylog2.

the class FilteredElasticsearchNodesSnifferTest method worksWithEmptyNodesListIfFilterIsSet.

@Test
void worksWithEmptyNodesListIfFilterIsSet() throws Exception {
    final List<Node> nodes = Collections.emptyList();
    final NodesSniffer nodesSniffer = new FilteredElasticsearchNodesSniffer(mockSniffer(nodes), "rack", "42");
    assertThat(nodesSniffer.sniff()).isEqualTo(nodes);
}
Also used : Node(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Node) NodesSniffer(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.NodesSniffer) Test(org.junit.jupiter.api.Test)

Aggregations

NodesSniffer (org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.NodesSniffer)8 Node (org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Node)6 Test (org.junit.jupiter.api.Test)6 ElasticsearchNodesSniffer (org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.ElasticsearchNodesSniffer)1