Search in sources :

Example 16 with Status

use of io.pravega.shared.health.Status 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);
}
Also used : Status(io.pravega.shared.health.Status) Health(io.pravega.shared.health.Health) Test(org.junit.Test)

Aggregations

Status (io.pravega.shared.health.Status)16 Test (org.junit.Test)11 Health (io.pravega.shared.health.Health)6 Cleanup (lombok.Cleanup)3 lombok.val (lombok.val)2 CacheManagerHealthContributor (io.pravega.segmentstore.server.CacheManager.CacheManagerHealthContributor)1 SegmentContainer (io.pravega.segmentstore.server.SegmentContainer)1 SegmentContainerRegistryHealthContributor (io.pravega.segmentstore.server.host.health.SegmentContainerRegistryHealthContributor)1 ZKHealthContributor (io.pravega.segmentstore.server.host.health.ZKHealthContributor)1 HealthContributor (io.pravega.shared.health.HealthContributor)1 HealthStatus (io.pravega.shared.health.bindings.generated.model.HealthStatus)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1