@Test public void status_YELLOW_when_two_GREEN_application_node_and_any_number_of_other_is_RED_or_GREEN() { Set<NodeHealth> nodeHealths = of( // at least 1 RED of(appNodeHealth(RED)), // 0 to 10 RED/GREEN randomNumberOfAppNodeHealthOfAnyStatus(GREEN, RED), // 2 GREEN nodeHealths(GREEN, GREEN)) .flatMap(s -> s) .collect(toSet()); Health check = underTest.check(nodeHealths); assertThat(check) .forInput(nodeHealths) .hasStatus(Health.Status.YELLOW) .andCauses("At least one application node is RED"); }
@Test public void status_GREEN_when_two_GREEN_application_node_and_any_number_of_other_is_GREEN() { Set<NodeHealth> nodeHealths = of( // at least 1 extra GREEN of(appNodeHealth(GREEN)), // 0 to 10 GREEN randomNumberOfAppNodeHealthOfAnyStatus(GREEN), // 2 GREEN nodeHealths(GREEN, GREEN)) .flatMap(s -> s) .collect(toSet()); Health check = underTest.check(nodeHealths); assertThat(check) .forInput(nodeHealths) .hasStatus(Health.Status.GREEN) .andCauses(); }
@Test public void status_YELLOW_when_two_GREEN_application_node_and_any_number_of_other_is_YELLOW_or_GREEN() { Set<NodeHealth> nodeHealths = of( // at least 1 YELLOW of(appNodeHealth(YELLOW)), // 0 to 10 YELLOW/GREEN randomNumberOfAppNodeHealthOfAnyStatus(GREEN, YELLOW), // 2 GREEN nodeHealths(GREEN, GREEN)) .flatMap(s -> s) .collect(toSet()); Health check = underTest.check(nodeHealths); assertThat(check) .forInput(nodeHealths) .hasStatus(Health.Status.YELLOW) .andCauses("At least one application node is YELLOW"); }
@Test public void status_YELLOW_when_two_GREEN_application_node_and_any_number_of_other_is_either_RED_or_YELLOW() { Set<NodeHealth> nodeHealths = of( // at least 1 RED of(appNodeHealth(RED)), // at least 1 YELLOW of(appNodeHealth(YELLOW)), // 0 to 10 RED/YELLOW/GREEN randomNumberOfAppNodeHealthOfAnyStatus(RED, YELLOW, GREEN), // 2 GREEN nodeHealths(GREEN, GREEN)) .flatMap(s -> s) .collect(toSet()); Health check = underTest.check(nodeHealths); assertThat(check) .forInput(nodeHealths) .hasStatus(Health.Status.YELLOW) .andCauses( "At least one application node is YELLOW", "At least one application node is RED"); }