use of io.pravega.shared.health.Health in project pravega by pravega.
the class SegmentContainerHealthContributorTest method testSegmentContainerHealth.
/**
* Check health of SegmentContainer with different states.
*/
@Test
public void testSegmentContainerHealth() {
when(segmentContainer.state()).thenReturn(Service.State.NEW);
Health.HealthBuilder builder = Health.builder().name(segmentContainerHealthContributor.getName());
Status status = segmentContainerHealthContributor.doHealthCheck(builder);
Assert.assertEquals("HealthContributor should report an 'NEW' Status.", Status.NEW, status);
when(segmentContainer.state()).thenReturn(Service.State.STARTING);
status = segmentContainerHealthContributor.doHealthCheck(builder);
Assert.assertEquals("HealthContributor should report an 'STARTING' Status.", Status.STARTING, status);
when(segmentContainer.state()).thenReturn(Service.State.RUNNING);
status = segmentContainerHealthContributor.doHealthCheck(builder);
Assert.assertEquals("HealthContributor should report an 'UP' Status.", Status.UP, status);
when(segmentContainer.state()).thenReturn(Service.State.TERMINATED);
status = segmentContainerHealthContributor.doHealthCheck(builder);
Assert.assertEquals("HealthContributor should report an 'DOWN' Status.", Status.DOWN, status);
}
use of io.pravega.shared.health.Health in project pravega by pravega.
the class ServiceStarterTest method testSegmentContainerRegistryHealth.
/**
* Check health of SegmentContainerRegistry
*/
@Test
public void testSegmentContainerRegistryHealth() {
@Cleanup SegmentContainerRegistryHealthContributor segmentContainerRegistryHealthContributor = new SegmentContainerRegistryHealthContributor(serviceStarter.getServiceBuilder().getSegmentContainerRegistry());
Health.HealthBuilder builder = Health.builder().name(segmentContainerRegistryHealthContributor.getName());
Status status = segmentContainerRegistryHealthContributor.doHealthCheck(builder);
Assert.assertEquals("HealthContributor should report an 'UP' Status.", Status.UP, status);
}
use of io.pravega.shared.health.Health in project pravega by pravega.
the class ServiceStarterTest method testHealth.
/**
* Check the health status of ServiceStarter
*/
@Test
public void testHealth() {
Health health = serviceStarter.getHealthServiceManager().getHealthSnapshot();
Assert.assertEquals("HealthContributor should report an 'UP' Status.", Status.UP, health.getStatus());
}
use of io.pravega.shared.health.Health in project pravega by pravega.
the class SegmentContainerRegistryHealthContributorTest method testSegmentContainerHealth.
/**
* Check health of SegmentContainerRegistry with different states.
*/
@Test
public void testSegmentContainerHealth() {
when(segmentContainerRegistry.isClosed()).thenReturn(true);
Health.HealthBuilder builder = Health.builder().name(segmentContainerRegistryHealthContributor.getName());
Status health = segmentContainerRegistryHealthContributor.doHealthCheck(builder);
Assert.assertEquals("HealthContributor should report an 'DOWN' Status.", Status.DOWN, health);
when(segmentContainerRegistry.isClosed()).thenReturn(false);
health = segmentContainerRegistryHealthContributor.doHealthCheck(builder);
Assert.assertEquals("HealthContributor should report an 'UP' Status.", Status.UP, health);
}
Aggregations