GeorgeJahad commented on a change in pull request #2961:
URL: https://github.com/apache/ozone/pull/2961#discussion_r778441221
##########
File path:
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java
##########
@@ -1238,123 +1260,113 @@ public void testListStatus() throws IOException {
@Test
public void testRefreshPipeline() throws Exception {
- MiniOzoneCluster cluster = MiniOzoneCluster.newBuilder(conf).build();
- try {
- cluster.waitForClusterToBeReady();
- OzoneManager ozoneManager = cluster.getOzoneManager();
+ OzoneManager ozoneManager = om;
- StorageContainerLocationProtocol sclProtocolMock = mock(
- StorageContainerLocationProtocol.class);
+ StorageContainerLocationProtocol sclProtocolMock = mock(
+ StorageContainerLocationProtocol.class);
- List<Long> containerIDs = new ArrayList<>();
- containerIDs.add(100L);
- containerIDs.add(200L);
+ List<Long> containerIDs = new ArrayList<>();
+ containerIDs.add(100L);
+ containerIDs.add(200L);
- List<ContainerWithPipeline> cps = new ArrayList<>();
- for (Long containerID : containerIDs) {
- ContainerWithPipeline containerWithPipelineMock =
- mock(ContainerWithPipeline.class);
- when(containerWithPipelineMock.getPipeline())
- .thenReturn(getRandomPipeline());
+ List<ContainerWithPipeline> cps = new ArrayList<>();
+ for (Long containerID : containerIDs) {
+ ContainerWithPipeline containerWithPipelineMock =
+ mock(ContainerWithPipeline.class);
+ when(containerWithPipelineMock.getPipeline())
+ .thenReturn(getRandomPipeline());
- ContainerInfo ci = mock(ContainerInfo.class);
- when(ci.getContainerID()).thenReturn(containerID);
- when(containerWithPipelineMock.getContainerInfo()).thenReturn(ci);
+ ContainerInfo ci = mock(ContainerInfo.class);
+ when(ci.getContainerID()).thenReturn(containerID);
+ when(containerWithPipelineMock.getContainerInfo()).thenReturn(ci);
- cps.add(containerWithPipelineMock);
- }
+ cps.add(containerWithPipelineMock);
+ }
- when(sclProtocolMock.getContainerWithPipelineBatch(containerIDs))
- .thenReturn(cps);
+ when(sclProtocolMock.getContainerWithPipelineBatch(containerIDs))
+ .thenReturn(cps);
- ScmClient scmClientMock = mock(ScmClient.class);
- when(scmClientMock.getContainerClient()).thenReturn(sclProtocolMock);
+ ScmClient scmClientMock = mock(ScmClient.class);
+ when(scmClientMock.getContainerClient()).thenReturn(sclProtocolMock);
- OmKeyInfo omKeyInfo = TestOMRequestUtils.createOmKeyInfo("v1",
- "b1", "k1", ReplicationType.RATIS,
- ReplicationFactor.THREE);
+ OmKeyInfo omKeyInfo = TestOMRequestUtils.createOmKeyInfo("v1",
+ "b1", "k1", ReplicationType.RATIS,
+ ReplicationFactor.THREE);
- // Add block to key.
- List<OmKeyLocationInfo> omKeyLocationInfoList = new ArrayList<>();
- Pipeline pipeline = getRandomPipeline();
+ // Add block to key.
+ List<OmKeyLocationInfo> omKeyLocationInfoList = new ArrayList<>();
+ Pipeline pipeline = getRandomPipeline();
- OmKeyLocationInfo omKeyLocationInfo =
- new OmKeyLocationInfo.Builder().setBlockID(
- new BlockID(100L, 1000L))
- .setOffset(0).setLength(100L).setPipeline(pipeline).build();
+ OmKeyLocationInfo omKeyLocationInfo =
+ new OmKeyLocationInfo.Builder().setBlockID(
+ new BlockID(100L, 1000L))
+ .setOffset(0).setLength(100L).setPipeline(pipeline).build();
- omKeyLocationInfoList.add(omKeyLocationInfo);
+ omKeyLocationInfoList.add(omKeyLocationInfo);
- OmKeyLocationInfo omKeyLocationInfo2 =
- new OmKeyLocationInfo.Builder().setBlockID(
- new BlockID(200L, 1000L))
- .setOffset(0).setLength(100L).setPipeline(pipeline).build();
- omKeyLocationInfoList.add(omKeyLocationInfo2);
+ OmKeyLocationInfo omKeyLocationInfo2 =
+ new OmKeyLocationInfo.Builder().setBlockID(
+ new BlockID(200L, 1000L))
+ .setOffset(0).setLength(100L).setPipeline(pipeline).build();
+ omKeyLocationInfoList.add(omKeyLocationInfo2);
- OmKeyLocationInfo omKeyLocationInfo3 =
- new OmKeyLocationInfo.Builder().setBlockID(
- new BlockID(100L, 2000L))
- .setOffset(0).setLength(100L).setPipeline(pipeline).build();
- omKeyLocationInfoList.add(omKeyLocationInfo3);
+ OmKeyLocationInfo omKeyLocationInfo3 =
+ new OmKeyLocationInfo.Builder().setBlockID(
+ new BlockID(100L, 2000L))
+ .setOffset(0).setLength(100L).setPipeline(pipeline).build();
+ omKeyLocationInfoList.add(omKeyLocationInfo3);
- omKeyInfo.appendNewBlocks(omKeyLocationInfoList, false);
+ omKeyInfo.appendNewBlocks(omKeyLocationInfoList, false);
- KeyManagerImpl keyManagerImpl =
- new KeyManagerImpl(ozoneManager, scmClientMock, conf, "om1");
+ KeyManagerImpl keyManagerImpl =
+ new KeyManagerImpl(ozoneManager, scmClientMock, conf, "om1");
- keyManagerImpl.refresh(omKeyInfo);
+ keyManagerImpl.refresh(omKeyInfo);
+
+ verify(sclProtocolMock, times(1))
+ .getContainerWithPipelineBatch(containerIDs);
- verify(sclProtocolMock, times(1))
- .getContainerWithPipelineBatch(containerIDs);
- } finally {
- cluster.shutdown();
- }
}
@Test
public void testRefreshPipelineException() throws Exception {
- MiniOzoneCluster cluster = MiniOzoneCluster.newBuilder(conf).build();
Review comment:
This function has only really been changed to remove the cluster, (which
has been replaced by the TestOmManager's OzoneManager.) Removing the try block
made it look like there were many other changes but they are just whitespace.
--
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]