Search in sources :

Example 1 with ThrowingContributor

use of io.pravega.shared.health.TestHealthContributors.ThrowingContributor in project pravega by pravega.

the class HealthContributorTests method testIndicatorThrows.

/**
 * If the {@link AbstractHealthContributor#doHealthCheck(Health.HealthBuilder)} throws an error, test that it is caught and
 * a {@link Health} result that reflects an 'unhealthy' state is returned.
 */
@Test
public void testIndicatorThrows() {
    @Cleanup ThrowingContributor contributor = new ThrowingContributor();
    Health health = contributor.getHealthSnapshot();
    Assert.assertEquals("HealthContributor should have a 'DOWN' Status.", Status.DOWN, health.getStatus());
    Assert.assertTrue("HealthContributor should be not be marked ready OR alive.", !health.isAlive() && !health.isReady());
}
Also used : ThrowingContributor(io.pravega.shared.health.TestHealthContributors.ThrowingContributor) Health(io.pravega.shared.health.Health) Cleanup(lombok.Cleanup) Test(org.junit.Test)

Aggregations

Health (io.pravega.shared.health.Health)1 ThrowingContributor (io.pravega.shared.health.TestHealthContributors.ThrowingContributor)1 Cleanup (lombok.Cleanup)1 Test (org.junit.Test)1