Search in sources :

Example 61 with ClusterHealthResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse in project sonarqube by SonarSource.

the class ElasticSearchMetricTaskTest method when_elasticsearch_down_status_is_updated_to_red.

@Test
public void when_elasticsearch_down_status_is_updated_to_red() {
    ClusterHealthResponse clusterHealthResponse = new ClusterHealthResponse();
    clusterHealthResponse.setStatus(ClusterHealthStatus.RED);
    when(esClient.clusterHealth(any())).thenReturn(clusterHealthResponse);
    underTest.run();
    verify(serverMonitoringMetrics, times(1)).setElasticSearchStatusToRed();
    verifyNoMoreInteractions(serverMonitoringMetrics);
}
Also used : ClusterHealthResponse(org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse) Test(org.junit.Test)

Example 62 with ClusterHealthResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse in project sonarqube by SonarSource.

the class ElasticSearchMetricTaskTest method when_no_es_status_null_status_is_updated_to_red.

@Test
public void when_no_es_status_null_status_is_updated_to_red() {
    ClusterHealthResponse clusterHealthResponse = Mockito.mock(ClusterHealthResponse.class);
    when(clusterHealthResponse.getStatus()).thenReturn(null);
    when(esClient.clusterHealth(any())).thenReturn(clusterHealthResponse);
    underTest.run();
    verify(serverMonitoringMetrics, times(1)).setElasticSearchStatusToRed();
    verifyNoMoreInteractions(serverMonitoringMetrics);
}
Also used : ClusterHealthResponse(org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse) Test(org.junit.Test)

Example 63 with ClusterHealthResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse in project sonarqube by SonarSource.

the class ElasticSearchMetricTaskTest method when_elasticsearch_yellow_status_is_updated_to_green.

@Test
public void when_elasticsearch_yellow_status_is_updated_to_green() {
    ClusterHealthResponse clusterHealthResponse = new ClusterHealthResponse();
    clusterHealthResponse.setStatus(ClusterHealthStatus.YELLOW);
    when(esClient.clusterHealth(any())).thenReturn(clusterHealthResponse);
    underTest.run();
    verify(serverMonitoringMetrics, times(1)).setElasticSearchStatusToGreen();
    verifyNoMoreInteractions(serverMonitoringMetrics);
}
Also used : ClusterHealthResponse(org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse) Test(org.junit.Test)

Example 64 with ClusterHealthResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse in project sonarqube by SonarSource.

the class ElasticSearchMetricTaskTest method when_elasticsearch_up_status_is_updated_to_green.

@Test
public void when_elasticsearch_up_status_is_updated_to_green() {
    ClusterHealthResponse clusterHealthResponse = new ClusterHealthResponse();
    clusterHealthResponse.setStatus(ClusterHealthStatus.GREEN);
    when(esClient.clusterHealth(any())).thenReturn(clusterHealthResponse);
    underTest.run();
    verify(serverMonitoringMetrics, times(1)).setElasticSearchStatusToGreen();
    verifyNoMoreInteractions(serverMonitoringMetrics);
}
Also used : ClusterHealthResponse(org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse) Test(org.junit.Test)

Example 65 with ClusterHealthResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse in project elasticsearch by elastic.

the class ClusterStatsIT method waitForNodes.

private void waitForNodes(int numNodes) {
    ClusterHealthResponse actionGet = client().admin().cluster().health(Requests.clusterHealthRequest().waitForEvents(Priority.LANGUID).waitForNodes(Integer.toString(numNodes))).actionGet();
    assertThat(actionGet.isTimedOut(), is(false));
}
Also used : ClusterHealthResponse(org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse)

Aggregations

ClusterHealthResponse (org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse)123 Settings (org.elasticsearch.common.settings.Settings)29 Client (org.elasticsearch.client.Client)24 ClusterState (org.elasticsearch.cluster.ClusterState)16 ClusterHealthRequest (org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest)15 Test (org.junit.Test)15 IOException (java.io.IOException)13 ClusterStateResponse (org.elasticsearch.action.admin.cluster.state.ClusterStateResponse)12 SearchResponse (org.elasticsearch.action.search.SearchResponse)11 MoveAllocationCommand (org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand)10 CloseIndexResponse (org.elasticsearch.action.admin.indices.close.CloseIndexResponse)9 OpenIndexResponse (org.elasticsearch.action.admin.indices.open.OpenIndexResponse)9 CountDownLatch (java.util.concurrent.CountDownLatch)7 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)7 IndexRequestBuilder (org.elasticsearch.action.index.IndexRequestBuilder)7 ShardRouting (org.elasticsearch.cluster.routing.ShardRouting)7 Index (org.elasticsearch.index.Index)7 MockTransportService (org.elasticsearch.test.transport.MockTransportService)6 TransportService (org.elasticsearch.transport.TransportService)6 Path (java.nio.file.Path)5