siddhantsangwan commented on code in PR #5191:
URL: https://github.com/apache/ozone/pull/5191#discussion_r1302504902
##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestPipelineManagerImpl.java:
##########
@@ -352,6 +353,60 @@ public void testRemovePipeline() throws Exception {
}
}
+ @Test
+ public void testRemoveContainerFromPipeline() throws Exception {
+ try (PipelineManagerImpl pipelineManager = createPipelineManager(true)) {
+ Pipeline ratisPipeline = pipelineManager.createPipeline(
+ RatisReplicationConfig.getInstance(ReplicationFactor.THREE));
+ pipelineManager.openPipeline(ratisPipeline.getId());
+ ECReplicationConfig ecRepConfig = new ECReplicationConfig(3, 2);
+ Pipeline ecPipeline = pipelineManager.createPipeline(ecRepConfig);
+ pipelineManager.openPipeline(ecPipeline.getId());
+
+ ContainerInfo ratisContainerInfo = HddsTestUtils.
+ getContainer(HddsProtos.LifeCycleState.OPEN, ratisPipeline.getId());
+ ContainerInfo ecContainerInfo = HddsTestUtils.getECContainer(
+ HddsProtos.LifeCycleState.OPEN, ecPipeline.getId(), ecRepConfig);
+
+ pipelineManager.addContainerToPipeline(ratisPipeline.getId(),
+ ratisContainerInfo.containerID());
+ pipelineManager.addContainerToPipeline(ecPipeline.getId(),
+ ecContainerInfo.containerID());
+
+ List<Pipeline> ratisPipelines = pipelineManager.getPipelines(
+ RatisReplicationConfig.getInstance(ReplicationFactor.THREE),
+ Pipeline.PipelineState.OPEN);
+
+ List<Pipeline> ecPipelines = pipelineManager.getPipelines(
+ ecRepConfig, Pipeline.PipelineState.OPEN);
+
+ // Background pipeline creator could create additional Ratis pipelines,
+ // so an equals check may not work. EC pipelines are created on demand,
+ // so an equals check is fine.
+ Assertions.assertTrue(ratisPipelines.contains(ratisPipeline));
+ Assertions.assertEquals(1, ecPipelines.size());
+
+ // Ensure both pipelines have a single container
+ Assertions.assertEquals(1, pipelineManager
+ .getContainersInPipeline(ratisPipeline.getId()).size());
+ Assertions.assertEquals(1, pipelineManager
+ .getContainersInPipeline(ratisPipeline.getId()).size());
Review Comment:
Should be `ecPipeline`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]