use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.Sniffer in project spring-boot by spring-projects.
the class ElasticsearchRestClientAutoConfigurationTests method configureWhenCustomSnifferShouldBackOff.
@Test
void configureWhenCustomSnifferShouldBackOff() {
Sniffer customSniffer = mock(Sniffer.class);
this.contextRunner.withBean(Sniffer.class, () -> customSniffer).run((context) -> {
assertThat(context).hasSingleBean(Sniffer.class);
Sniffer sniffer = context.getBean(Sniffer.class);
assertThat(sniffer).isSameAs(customSniffer);
then(customSniffer).shouldHaveNoInteractions();
});
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.Sniffer in project spring-boot by spring-projects.
the class ElasticsearchRestClientAutoConfigurationTests method configureWithCustomSnifferSettings.
@Test
void configureWithCustomSnifferSettings() {
this.contextRunner.withPropertyValues("spring.elasticsearch.restclient.sniffer.interval=180s", "spring.elasticsearch.restclient.sniffer.delay-after-failure=30s").run((context) -> {
assertThat(context).hasSingleBean(Sniffer.class);
Sniffer sniffer = context.getBean(Sniffer.class);
assertThat(sniffer).hasFieldOrPropertyWithValue("sniffIntervalMillis", Duration.ofMinutes(3).toMillis());
assertThat(sniffer).hasFieldOrPropertyWithValue("sniffAfterFailureDelayMillis", Duration.ofSeconds(30).toMillis());
});
}