HDDS-1047. Fix TestRatisPipelineProvider#testCreatePipelineWithFactor. Contributed by Nilotpal Nandi.
This commit is contained in:
parent
3dc2523266
commit
06d7890bdd
@ -50,6 +50,28 @@ public void init() throws Exception {
|
||||
stateManager, new OzoneConfiguration());
|
||||
}
|
||||
|
||||
private void createPipelineAndAssertions(
|
||||
HddsProtos.ReplicationFactor factor) throws IOException {
|
||||
Pipeline pipeline = provider.create(factor);
|
||||
stateManager.addPipeline(pipeline);
|
||||
Assert.assertEquals(pipeline.getType(), HddsProtos.ReplicationType.RATIS);
|
||||
Assert.assertEquals(pipeline.getFactor(), factor);
|
||||
Assert.assertEquals(pipeline.getPipelineState(),
|
||||
Pipeline.PipelineState.OPEN);
|
||||
Assert.assertEquals(pipeline.getNodes().size(), factor.getNumber());
|
||||
Pipeline pipeline1 = provider.create(factor);
|
||||
stateManager.addPipeline(pipeline1);
|
||||
// New pipeline should not overlap with the previous created pipeline
|
||||
Assert.assertTrue(
|
||||
CollectionUtils.intersection(pipeline.getNodes(), pipeline1.getNodes())
|
||||
.isEmpty());
|
||||
Assert.assertEquals(pipeline1.getType(), HddsProtos.ReplicationType.RATIS);
|
||||
Assert.assertEquals(pipeline1.getFactor(), factor);
|
||||
Assert.assertEquals(pipeline1.getPipelineState(),
|
||||
Pipeline.PipelineState.OPEN);
|
||||
Assert.assertEquals(pipeline1.getNodes().size(), factor.getNumber());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreatePipelineWithFactor() throws IOException {
|
||||
HddsProtos.ReplicationFactor factor = HddsProtos.ReplicationFactor.THREE;
|
||||
@ -76,6 +98,16 @@ public void testCreatePipelineWithFactor() throws IOException {
|
||||
Assert.assertEquals(pipeline1.getNodes().size(), factor.getNumber());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreatePipelineWithFactorThree() throws IOException {
|
||||
createPipelineAndAssertions(HddsProtos.ReplicationFactor.THREE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreatePipelineWithFactorOne() throws IOException {
|
||||
createPipelineAndAssertions(HddsProtos.ReplicationFactor.ONE);
|
||||
}
|
||||
|
||||
private List<DatanodeDetails> createListOfNodes(int nodeCount) {
|
||||
List<DatanodeDetails> nodes = new ArrayList<>();
|
||||
for (int i = 0; i < nodeCount; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user