use of org.sonar.process.cluster.health.NodeHealth in project sonarqube by SonarSource.
the class SearchNodeHealthProviderTest method get_returns_status_RED_with_cause_if_elasticsearch_process_is_not_operational_in_ClusterAppState.
@Test
public void get_returns_status_RED_with_cause_if_elasticsearch_process_is_not_operational_in_ClusterAppState() {
Properties properties = new Properties();
setRequiredPropertiesAndMocks(properties);
when(clusterAppState.isOperational(ProcessId.ELASTICSEARCH, true)).thenReturn(false);
SearchNodeHealthProvider underTest = new SearchNodeHealthProvider(new Props(properties), clusterAppState, networkUtils, clock);
NodeHealth nodeHealth = underTest.get();
assertThat(nodeHealth.getStatus()).isEqualTo(NodeHealth.Status.RED);
assertThat(nodeHealth.getCauses()).containsOnly("Elasticsearch is not operational");
}
use of org.sonar.process.cluster.health.NodeHealth in project sonarqube by SonarSource.
the class AppNodeClusterCheckTest method status_YELLOW_when_single_YELLOW_application_node.
@Test
public void status_YELLOW_when_single_YELLOW_application_node() {
Set<NodeHealth> nodeHealths = nodeHealths(YELLOW).collect(toSet());
Health check = underTest.check(nodeHealths);
assertThat(check).forInput(nodeHealths).hasStatus(Health.Status.YELLOW).andCauses("Status of all application nodes is YELLOW", "There should be at least two application nodes");
}
use of org.sonar.process.cluster.health.NodeHealth in project sonarqube by SonarSource.
the class AppNodeClusterCheckTest method status_YELLOW_when_two_YELLOW_application_nodes.
@Test
public void status_YELLOW_when_two_YELLOW_application_nodes() {
Set<NodeHealth> nodeHealths = nodeHealths(YELLOW, YELLOW).collect(toSet());
Health check = underTest.check(nodeHealths);
assertThat(check).forInput(nodeHealths).hasStatus(Health.Status.YELLOW).andCauses("Status of all application nodes is YELLOW");
}
use of org.sonar.process.cluster.health.NodeHealth in project sonarqube by SonarSource.
the class AppNodeClusterCheckTest method status_RED_when_no_application_node.
@Test
public void status_RED_when_no_application_node() {
Set<NodeHealth> nodeHealths = nodeHealths().collect(toSet());
Health check = underTest.check(nodeHealths);
assertThat(check).forInput(nodeHealths).hasStatus(Health.Status.RED).andCauses("No application node");
}
use of org.sonar.process.cluster.health.NodeHealth in project sonarqube by SonarSource.
the class AppNodeClusterCheckTest method status_YELLOW_when_one_YELLOW_node_and_one_GREEN_application_node.
@Test
public void status_YELLOW_when_one_YELLOW_node_and_one_GREEN_application_node() {
Set<NodeHealth> nodeHealths = nodeHealths(YELLOW, GREEN).collect(toSet());
Health check = underTest.check(nodeHealths);
assertThat(check).forInput(nodeHealths).hasStatus(Health.Status.YELLOW).andCauses("At least one application node is YELLOW");
}
Aggregations