use of org.apache.hadoop.hdds.scm.container.placement.algorithms.ContainerPlacementStatusDefault in project ozone by apache.
the class TestContainerHealthStatus method setup.
@Before
public void setup() {
placementPolicy = mock(PlacementPolicy.class);
container = mock(ContainerInfo.class);
when(container.getReplicationConfig()).thenReturn(RatisReplicationConfig.getInstance(HddsProtos.ReplicationFactor.THREE));
when(container.containerID()).thenReturn(ContainerID.valueOf(123456));
when(container.getContainerID()).thenReturn((long) 123456);
when(placementPolicy.validateContainerPlacement(Mockito.anyList(), Mockito.anyInt())).thenReturn(new ContainerPlacementStatusDefault(1, 1, 1));
}
use of org.apache.hadoop.hdds.scm.container.placement.algorithms.ContainerPlacementStatusDefault in project ozone by apache.
the class TestContainerHealthStatus method testMisReplicated.
@Test
public void testMisReplicated() {
Set<ContainerReplica> replicas = generateReplicas(container, ContainerReplicaProto.State.CLOSED, ContainerReplicaProto.State.CLOSED, ContainerReplicaProto.State.CLOSED);
when(placementPolicy.validateContainerPlacement(Mockito.anyList(), Mockito.anyInt())).thenReturn(new ContainerPlacementStatusDefault(1, 2, 5));
ContainerHealthStatus status = new ContainerHealthStatus(container, replicas, placementPolicy);
assertFalse(status.isHealthy());
assertFalse(status.isMissing());
assertFalse(status.isUnderReplicated());
assertFalse(status.isOverReplicated());
assertEquals(0, status.replicaDelta());
assertTrue(status.isMisReplicated());
assertEquals(1, status.misReplicatedDelta());
}
Aggregations