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();
}
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);
}
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);
}
Aggregations