ChenSammi commented on code in PR #5662:
URL: https://github.com/apache/ozone/pull/5662#discussion_r1461983458
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/impl/TestBlockManagerImpl.java:
##########
@@ -222,4 +227,175 @@ public void testListBlock(ContainerTestVersionInfo
versionInfo)
assertNotNull(listBlockData);
assertEquals(10, listBlockData.size());
}
+
+ private BlockData createBlockData(long containerID, long blockNo,
+ int chunkID, long offset, long len, long bcsID)
+ throws IOException {
+ blockID1 = new BlockID(containerID, blockNo);
+ blockData = new BlockData(blockID1);
+ List<ContainerProtos.ChunkInfo> chunkList1 = new ArrayList<>();
+ ChunkInfo info1 = new ChunkInfo(String.format("%d_chunk_%d", blockID1
+ .getLocalID(), chunkID), offset, len);
+ chunkList1.add(info1.getProtoBufMessage());
+ blockData.setChunks(chunkList1);
+ blockData.setBlockCommitSequenceId(bcsID);
+ blockData.addMetadata(INCREMENTAL_CHUNK_LIST, "");
+
+ return blockData;
+ }
+
+ private BlockData createBlockDataWithOneFullChunk(long containerID,
+ long blockNo, int chunkID, long offset, long len, long bcsID)
+ throws IOException {
+ blockID1 = new BlockID(containerID, blockNo);
+ blockData = new BlockData(blockID1);
+ List<ContainerProtos.ChunkInfo> chunkList1 = new ArrayList<>();
+ ChunkInfo info1 = new ChunkInfo(String.format("%d_chunk_%d", blockID1
+ .getLocalID(), 1), 0, 4 * 1024 * 1024);
+ info1.addMetadata(FULL_CHUNK, "");
+
+ ChunkInfo info2 = new ChunkInfo(String.format("%d_chunk_%d", blockID1
+ .getLocalID(), chunkID), offset, len);
+ chunkList1.add(info1.getProtoBufMessage());
+ chunkList1.add(info2.getProtoBufMessage());
+ blockData.setChunks(chunkList1);
+ blockData.setBlockCommitSequenceId(bcsID);
+ blockData.addMetadata(INCREMENTAL_CHUNK_LIST, "");
+
+ return blockData;
+ }
+
+ private BlockData createBlockDataWithThreeFullChunks(long containerID,
+ long blockNo, long bcsID) throws IOException {
+ blockID1 = new BlockID(containerID, blockNo);
+ blockData = new BlockData(blockID1);
+ List<ContainerProtos.ChunkInfo> chunkList1 = new ArrayList<>();
+ long chunkLimit = 4 * 1024 * 1024;
+ for (int i = 1; i < 4; i++) {
+ ChunkInfo info1 = new ChunkInfo(
+ String.format("%d_chunk_%d", blockID1.getLocalID(), i),
+ chunkLimit * i, chunkLimit);
+ info1.addMetadata(FULL_CHUNK, "");
+ chunkList1.add(info1.getProtoBufMessage());
+ }
+ blockData.setChunks(chunkList1);
+ blockData.setBlockCommitSequenceId(bcsID);
+ blockData.addMetadata(INCREMENTAL_CHUNK_LIST, "");
+
+ return blockData;
+ }
+
+ @ContainerTestVersionInfo.ContainerTest
Review Comment:
When using @ContainerTestVersionInfo.ContainerTest, the test shall have a
"ContainerTestVersionInfo versionInfo" parameter, otherwise, the parameterized
test is not actually enabled.
` @ContainerTestVersionInfo.ContainerTest
public void testPendingDeleteBlockReset(ContainerTestVersionInfo
versionInfo)
`
--
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]