use of org.sonar.application.es.EsConnector in project sonarqube by SonarSource.
the class EsManagedProcessTest method isOperational_should_return_false_if_status_is_unknown.
@Test
public void isOperational_should_return_false_if_status_is_unknown() {
EsConnector esConnector = mock(EsConnector.class);
when(esConnector.getClusterHealthStatus()).thenReturn(Optional.empty());
EsManagedProcess underTest = new EsManagedProcess(mock(Process.class), ProcessId.ELASTICSEARCH, esConnector, WAIT_FOR_UP_TIMEOUT);
assertThat(underTest.isOperational()).isFalse();
}
use of org.sonar.application.es.EsConnector in project sonarqube by SonarSource.
the class EsManagedProcessTest method isOperational_should_return_false_if_Elasticsearch_status_cannot_be_evaluated.
@Test
public void isOperational_should_return_false_if_Elasticsearch_status_cannot_be_evaluated() {
EsConnector esConnector = mock(EsConnector.class);
when(esConnector.getClusterHealthStatus()).thenThrow(new RuntimeException("test"));
EsManagedProcess underTest = new EsManagedProcess(mock(Process.class), ProcessId.ELASTICSEARCH, esConnector, WAIT_FOR_UP_TIMEOUT);
assertThat(underTest.isOperational()).isFalse();
}
use of org.sonar.application.es.EsConnector in project sonarqube by SonarSource.
the class EsManagedProcessTest method isOperational_should_retry_if_Elasticsearch_is_unreachable.
@Test
public void isOperational_should_retry_if_Elasticsearch_is_unreachable() {
EsConnector esConnector = mock(EsConnector.class);
when(esConnector.getClusterHealthStatus()).thenReturn(Optional.empty()).thenReturn(Optional.of(ClusterHealthStatus.GREEN));
EsManagedProcess underTest = new EsManagedProcess(mock(Process.class), ProcessId.ELASTICSEARCH, esConnector, WAIT_FOR_UP_TIMEOUT);
assertThat(underTest.isOperational()).isTrue();
}
use of org.sonar.application.es.EsConnector in project sonarqube by SonarSource.
the class EsManagedProcessTest method isOperational_should_return_false_if_ElasticsearchException_thrown.
@Test
public void isOperational_should_return_false_if_ElasticsearchException_thrown() {
EsConnector esConnector = mock(EsConnector.class);
when(esConnector.getClusterHealthStatus()).thenThrow(new ElasticsearchException("test"));
EsManagedProcess underTest = new EsManagedProcess(mock(Process.class), ProcessId.ELASTICSEARCH, esConnector, WAIT_FOR_UP_TIMEOUT);
assertThat(underTest.isOperational()).isFalse();
}
use of org.sonar.application.es.EsConnector in project sonarqube by SonarSource.
the class EsManagedProcessTest method isOperational_should_return_true_if_Elasticsearch_is_GREEN.
@Test
public void isOperational_should_return_true_if_Elasticsearch_is_GREEN() {
EsConnector esConnector = mock(EsConnector.class);
when(esConnector.getClusterHealthStatus()).thenReturn(Optional.of(ClusterHealthStatus.GREEN));
EsManagedProcess underTest = new EsManagedProcess(mock(Process.class), ProcessId.ELASTICSEARCH, esConnector, WAIT_FOR_UP_TIMEOUT);
assertThat(underTest.isOperational()).isTrue();
}
Aggregations