use of org.sonar.process.cluster.health.NodeHealth in project sonarqube by SonarSource.
the class ClusterHealthTest method hashcode_is_based_on_content.
@Test
public void hashcode_is_based_on_content() {
Health health = randomHealth();
Set<NodeHealth> nodeHealths = randomNodeHealths();
ClusterHealth underTest = new ClusterHealth(health, nodeHealths);
assertThat(underTest).hasSameHashCodeAs(underTest);
}
use of org.sonar.process.cluster.health.NodeHealth in project sonarqube by SonarSource.
the class HealthActionTest method response_contains_information_of_nodes_when_clustered.
@Test
public void response_contains_information_of_nodes_when_clustered() {
authenticateWithRandomMethod();
NodeHealth nodeHealth = randomNodeHealth();
when(webServer.isStandalone()).thenReturn(false);
when(healthChecker.checkCluster()).thenReturn(new ClusterHealth(GREEN, singleton(nodeHealth)));
System.HealthResponse response = underTest.newRequest().executeProtobuf(System.HealthResponse.class);
assertThat(response.getNodes().getNodesList()).hasSize(1);
System.Node node = response.getNodes().getNodesList().iterator().next();
assertThat(node.getHealth().name()).isEqualTo(nodeHealth.getStatus().name());
assertThat(node.getCausesList()).extracting(System.Cause::getMessage).containsOnly(nodeHealth.getCauses().toArray(new String[0]));
assertThat(node.getName()).isEqualTo(nodeHealth.getDetails().getName());
assertThat(node.getHost()).isEqualTo(nodeHealth.getDetails().getHost());
assertThat(node.getPort()).isEqualTo(nodeHealth.getDetails().getPort());
assertThat(node.getStartedAt()).isEqualTo(formatDateTime(nodeHealth.getDetails().getStartedAt()));
assertThat(node.getType().name()).isEqualTo(nodeHealth.getDetails().getType().name());
}
Aggregations