use of org.sonar.process.cluster.health.NodeHealth in project sonarqube by SonarSource.
the class AppNodeClusterCheckTest method status_YELLOW_when_single_GREEN_application_node.
@Test
public void status_YELLOW_when_single_GREEN_application_node() {
Set<NodeHealth> nodeHealths = nodeHealths(GREEN).collect(toSet());
Health check = underTest.check(nodeHealths);
assertThat(check).forInput(nodeHealths).hasStatus(Health.Status.YELLOW).andCauses("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_one_RED_node_and_one_GREEN_application_node.
@Test
public void status_YELLOW_when_one_RED_node_and_one_GREEN_application_node() {
Set<NodeHealth> nodeHealths = nodeHealths(RED, GREEN).collect(toSet());
Health check = underTest.check(nodeHealths);
assertThat(check).forInput(nodeHealths).hasStatus(Health.Status.YELLOW).andCauses("At least one application node is RED");
}
use of org.sonar.process.cluster.health.NodeHealth in project sonarqube by SonarSource.
the class ClusterHealthTest method verify_toString.
@Test
public void verify_toString() {
Health health = randomHealth();
Set<NodeHealth> nodeHealths = randomNodeHealths();
ClusterHealth underTest = new ClusterHealth(health, nodeHealths);
assertThat(underTest.toString()).isEqualTo("ClusterHealth{health=" + health + ", nodes=" + nodeHealths + "}");
}
use of org.sonar.process.cluster.health.NodeHealth in project sonarqube by SonarSource.
the class ClusterHealthTest method verify_getters.
@Test
public void verify_getters() {
Health health = randomHealth();
Set<NodeHealth> nodeHealths = randomNodeHealths();
ClusterHealth underTest = new ClusterHealth(health, nodeHealths);
assertThat(underTest.getHealth()).isSameAs(health);
assertThat(underTest.getNodes()).isEqualTo(nodeHealths);
}
use of org.sonar.process.cluster.health.NodeHealth in project sonarqube by SonarSource.
the class ClusterHealthTest method equals_is_based_on_content.
@Test
public void equals_is_based_on_content() {
Health health = randomHealth();
Set<NodeHealth> nodeHealths = randomNodeHealths();
ClusterHealth underTest = new ClusterHealth(health, nodeHealths);
assertThat(underTest).isEqualTo(underTest).isEqualTo(new ClusterHealth(health, nodeHealths)).isNotEqualTo(new Object()).isNotNull().isNotEqualTo(new ClusterHealth(newHealthCheckBuilder().setStatus(health.getStatus()).addCause("foo_bar").build(), randomNodeHealths())).isNotEqualTo(new ClusterHealth(health, concat(nodeHealths.stream(), Stream.of(randomNodeHealth())).collect(toSet())));
}
Aggregations